巨大なテーブルをパーティションキーで小さな物理的な子テーブルに分割し、各クエリが数十億行をスキャンする代わりに必要なパーティションだけに触れるようにします(パーティションプルーニング)。 50億の注文行を持つテーブルでも1つの論理テーブルのように振る舞いますが、WHERE がパーティションキーでフィルタするとエンジンはその99%をスキップします。
パーティション分割されたテーブルの形
text
orders (logical parent)
│ partition key = created_at
┌────────────────┼────────────────┬───────────────┐
▼ ▼ ▼ ▼
orders_2024_q1 orders_2024_q2 orders_2024_q3 orders_2025_q1
(child table) (child table) (child table) (child, active)
│ │
local index local index
(per child) (per child)
