Concept
Query plan
A query plan is the set of steps a database chooses to answer a query: which indexes to read, in what order to join tables and by which method. The planner picks it from estimates of how many rows each step will return, based on statistics about the data. When those estimates are far from the real counts, the plan can be thousands of times slower than a better one.
Where you'll see it
Related concepts
Sources: PostgreSQL documentation: using EXPLAIN ↗ · PostgreSQL documentation: EXPLAIN command reference ↗ · PostgreSQL documentation: statistics used by the planner ↗ · PostgreSQL documentation: routine vacuuming, updating planner statistics ↗ · Report a problem
The definition is in our own words; the sources are those of the lesson Reading query plans.