بڑی table کو ایک partition key سے چھوٹی physical child tables میں تقسیم کریں، تاکہ ہر query صرف انہی partitions کو چھوئے جن کی اسے ضرورت ہو (partition pruning) بجائے اربوں rows scan کرنے کے۔ 5 ارب order rows والی table اب بھی ایک logical table کی طرح برتاؤ کرتی ہے، مگر جب آپ کا WHERE partition key پر filter کرتا ہے تو engine اس کا 99% چھوڑ دیتا ہے۔
ایک partitioned table کی شکل
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)
