liveBook · Manning

Planning time

As explained in Just Use Postgres!

Planning time is the elapsed time a database query planner spends selecting an execution plan.

Planning time is the elapsed time PostgreSQL spends choosing an execution plan for a query. EXPLAIN ANALYZE reports it separately from execution time; together, they form the query's total measured time. section 4.4

Measure planning time with EXPLAIN ANALYZE

Run EXPLAIN ANALYZE on an indexed lookup. The plan reports an Index Scan, Planning Time of 0.119 ms, and Execution Time of 0.077 ms. Repeat the query until the measurements become consistent because initial executions may be slower.

How Just Use Postgres! covers it

How deep it goes
Defines planning time, distinguishes it from execution time, and demonstrates its EXPLAIN ANALYZE output without examining planner internals.
Examples
Demonstrates an indexed player lookup whose plan reports 0.119 ms planning time and 0.077 ms execution time.
What it assumes
Assumes familiarity with SQL queries and PostgreSQL execution plans while clarifying the difference between planning and execution time.
What you can do after
Diagnose query timing with EXPLAIN ANALYZE and distinguish planning overhead from execution cost.
How it connects
Connects planning time with EXPLAIN, EXPLAIN ANALYZE, execution plans, execution time, and indexes.

This explainer was generated by Manning's knowledge graph from the text of Just Use Postgres!. The section links point to the parts of the book it draws on.