Database Engineering · Finding data fast
How a query runs
Your SQL says what you want, not how to get it. The planner estimates the cost of several ways to run it from table statistics and picks the cheapest. EXPLAIN shows you its choice.
- Time16 min
- LevelDeveloper
- Experiments1 live
- Check6 questions






Parser checks the SQL grammar and builds a query tree.
Rewriter replaces any views with the queries behind them.
Statistics the planner reads row counts and common values for each column.
Executor runs the plan tree and streams the rows back to the client.
Limit stops after the first 20 rows.
Sort orders the joined rows by date, newest first.
Scans a Seq Scan on orders and a Seq Scan on customers feed the join.