query planner
The part of the database that turns a SQL query into a plan, choosing among indexes, scans and join orders.
In more detail
Because SQL says what you want, not how to get it, the planner decides, using statistics about the data to estimate costs. It may still prefer a scan when an index would not help, and a bad row estimate can lead it to a bad join.
Related terms
- 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.
- EXPLAIN — A command placed before a query that shows the plan the database would use instead of running it normally.
- index — A separate, sorted structure a database keeps alongside a table so it can find matching rows without reading them all.
- row estimate — The planner's guess at how many rows a step of a query will produce, used to choose the plan.
Taught in
- Ordering And Limiting Results — PostgreSQL, Indexing & Relational Data Modeling
- Indexes And What They Cost — PostgreSQL, Indexing & Relational Data Modeling
- Reading An EXPLAIN Plan — PostgreSQL, Indexing & Relational Data Modeling