Core conceptsintermediate

Query planner

The cost-based optimizer that turns a parsed query into an execution plan by estimating the cost of alternative scans, joins, and orderings.

What this means

For one SQL query there are usually many ways to run it, scan the whole table, use this index or that one, join in this order or that. The planner is the part that estimates the cost of each option from the table statistics and picks the cheapest before a single row is fetched.

Why it matters operationally

Reading and influencing planner decisions (via statistics, indexes, and settings) is the core skill of query performance work.

Where it lives in the source

src/backend/optimizer/plan/planner.c

← All glossary terms · GUC reference · Error catalog