Skip to content
Commitwise
Menu

Query plan

Also called: Execution plan, EXPLAIN

The steps a database chooses to execute a query (scans, index lookups, joins, sorts), shown with EXPLAIN.

Definition

The planner estimates how many rows each step produces and picks the cheapest plan it can find. EXPLAIN ANALYZE runs the query and shows actual rows and times next to the estimates, which reveals missing indexes, sequential scans on large tables, sorts that spill to disk and bad estimates caused by stale statistics.

In practice

A plan showing a Seq Scan with 39 million rows removed by filter points to a missing index on customer_id.

Learn it in context

Lessons that use this term.

Related terms

Esc

Type to search the whole site.