query plan
The step-by-step route the database has chosen to answer a query: which tables to read, in what order, and with which indexes.
In more detail
EXPLAIN shows it. The plan depends on the schema, the indexes, statistics about the data and the database version, so it is evidence about today's data, not a permanent promise. Recheck it when the data distribution changes.
Related terms
- EXPLAIN — A command placed before a query that shows the plan the database would use instead of running it normally.
- query planner — The part of the database that turns a SQL query into a plan, choosing among indexes, scans and join orders.
- table scan — Reading every row of a table to find the ones that match, instead of jumping to them through an index.
- index search — In a query plan, a step that starts from a key in an index and reads only the matching rows.
Taught in
- Cross Joins And Cartesian Bugs — PostgreSQL, Indexing & Relational Data Modeling
- Reading An EXPLAIN Plan — PostgreSQL, Indexing & Relational Data Modeling