Query processing

Plan tree

Also called: PlannedStmt, execution plan, plan nodes

The planner's output is a plan tree: a tree of operations, sequential scan, index scan, hash join, sort, that, executed bottom-up, produces your result. It is the finished strategy the executor will follow.

What this means

The planner's finished blueprint: a tree of concrete operations (scan this table, use that index, hash-join here, sort there) that, run from the bottom up, produces your result. The executor's whole job is to follow it, step by step.

Why it matters operationally

The plan tree is exactly what EXPLAIN prints. Reading it tells you which access methods and join strategies PostgreSQL chose, and comparing the planner's estimates with reality (via EXPLAIN ANALYZE) is the single most useful query-tuning skill.

Related & next

The Parse, Plan, Execute Pipeline, where the plan tree is builtReading EXPLAIN, how to interpret the plan treePortal, the container that executes the plan

← All glossary terms · GUC reference · Error catalog