Arcade
Query Planner
Phase 05 · Backend EngineeringPlayable
Add the indexes that turn a collection scan into a bounded lookup.
0 / 6 cleared
orders10.0M rows · 200k pages
| column | distinct | note |
|---|---|---|
| id | 10.0M | |
| user_id | 2.0M | |
| status | 4 | paid, pending, shipped, refunded |
| created_at | 9.0M | |
| total | 40k |
The query
SELECT * FROM orders WHERE user_id = 4471
Level 1
Find one customer’s orders without reading the table.
target ≤ 40 pages · at most 1 index
Indexes
- none: the planner has only the table
EXPLAIN
Seq Scan on orders
- rows examined · 10.0M
- pages read · 200k (target 40)
- write cost · 1 row + 0 index updates
No index covers this query, so every page is read.
Write user_id, created_at or the whole CREATE INDEX ON orders (user_id, created_at); both parse. Fifty rows to a page and a four-level tree are this planner’s simplifications; the ordering rules it applies are the real ones.