Read the plan; the plan is the truth.
Query Plans and Execution: read the plan
shape data so reads and writes stay honest
Stats too stale → bad plans.
The query planner converts SQL into a tree of physical operators. Reading these trees lets you reason about why a query is slow, faster than guessing.
Joins: nested loop (small inputs), hash join (large unsorted), merge join (sorted inputs).
Slow patterns: seq scan on big table, sort spill, bad estimates, missing index.
ANALYZE updates stats; planner depends on them.
Slow report: filter + join + group.