leastfixedpoint

Tony's Link Log

All tags.

How Often is the Query Plan Optimal?.

Tomas Vondra (30 June 2025)
đź”— https://vondra.me/posts/how-often-is-the-query-plan-optimal/
#databases #bcs1510 #bcs

Investigation of the PostgreSQL query planner:

The basic promise of a query optimizer is that it picks the “optimal” query plan. But there’s a catch - the plan selection relies on cost estimates, calculated from selectivity estimates and cost of basic resources (I/O, CPU, …). So the question is, how often do we actually pick the “fastest” plan? And the truth is we actually make mistakes quite often.