When Does q-error Predict Plan Regret? Three Regimes of Cardinality-Estimation Error
Summary
A new analysis investigates when q-error, a standard metric for cardinality-estimation (CE) research, accurately predicts query-plan quality, or "plan regret." The study identifies three distinct regimes of cardinality-estimation error. For small errors, a true-point condition number kappa predicts regret better than q-error, though its predictive power diminishes as error grows. In the regime of large errors, where many deployed learned estimators operate, q-error is largely uninformative (Spearman rho ~ 0.05). Instead, an estimator-independent average-case sub-optimality measure, ACS-infinity, effectively predicts regret-prone queries (Spearman rho ~ 0.54 on STATS-CEB). The worst-case scenario is characterized by Haritsa's maximum sub-optimality (MSO). The research validates these findings on STATS-CEB and JOB-light datasets using four released estimators. It confirms ACS-infinity's predictive power on real PostgreSQL runtime, offering a conceptual and empirical contribution to robust query optimization.
Key takeaway
Database engineers optimizing query performance should recognize q-error is an unreliable metric for plan quality in scenarios with large cardinality estimation errors. Instead, focus on average-case sub-optimality measures like ACS-infinity. These demonstrably predict regret-prone queries, especially when using learned estimators. This insight suggests re-evaluating your current optimization strategies. Integrate ACS-infinity into evaluation frameworks for more robust query plans.
Key insights
The relationship between q-error and plan regret varies across three error regimes, with ACS-infinity being key for large errors.
Principles
- Plan regret is governed by plan-cost geometry.
- q-error is uninformative for large CE errors.
- ACS-infinity predicts regret-prone queries.
Topics
- Cardinality Estimation
- Query Optimization
- Plan Regret
- q-error
- ACS-infinity
- Database Performance
- Learned Estimators
Best for: AI Scientist, Research Scientist, Machine Learning Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Machine Learning.