NOTE

PostgreSQL EXPLAIN

Reading scan, join, sort, aggregate, estimate, and runtime information from PostgreSQL plans.

DatabasesCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

EXPLAIN shows the planner’s chosen operator tree and cost/cardinality estimates. EXPLAIN ANALYZE executes the statement and adds actual timing/row/loop information, so use it carefully for writes or expensive production queries.

Focus on where estimated and actual rows diverge, repeated loops, scan type, join algorithm, sort/hash memory/spill behavior, and buffers/I/O where available. Cost numbers are planner units, not milliseconds.

Loading helpful count