arXiv:2510.03386cs.DBcs.LG2025-10被引 1

用子查询模式匹配提升数据库基数估算效率,兼顾精度与低成本。

Is it Bigger than a Breadbox: Efficient Cardinality Estimation for Real World Workloads

  • 基于子查询图结构哈希,动态匹配简单回归器进行估算。
  • 在IMDb数据集上加速超30%,仅需37秒在线学习开销。
  • 适合追求高性价比的生产环境数据库优化使用。

数据库引擎依赖成本模型生成高效查询计划。实际系统多采用启发式基数估算,通过调参提升基准测试平均表现,但估算误差随查询复杂度显著上升。学习型估算器虽更准确,却增加运维复杂性,难以落地。本文发现工作负载中存在大量重复的子查询模式,提出在线学习多个轻量级回归器,每个对应特定模式,并通过子查询图结构的哈希实现随机访问。该方法开销极低,在误差指标上媲美当前最优学习方法。将该方案集成至PostgreSQL后,相比传统方法显著提升准确率与执行速度,且相较其他学习型估算器大幅降低运维成本。具体而言,在IMDb上的JOB-lite工作负载模拟中,执行时间缩短7.5分钟(>30%),在线学习仅耗时37秒。

原文摘要 · Abstract (English)

DB engines produce efficient query execution plans by relying on cost models. Practical implementations estimate cardinality of queries using heuristics, with magic numbers tuned to improve average performance on benchmarks. Empirically, estimation error significantly grows with query complexity. Alternatively, learning-based estimators offer improved accuracy, but add operational complexity preventing their adoption in-practice. Recognizing that query workloads contain highly repetitive subquery patterns, we learn many simple regressors online, each localized to a pattern. The regressor corresponding to a pattern can be randomly-accessed using hash of graph structure of the subquery. Our method has negligible overhead and competes with SoTA learning-based approaches on error metrics. Further, amending PostgreSQL with our method achieves notable accuracy and runtime improvements over traditional methods and drastically reduces operational costs compared to other learned cardinality estimators, thereby offering the most practical and efficient solution on the Pareto frontier. Concretely, simulating JOB-lite workload on IMDb speeds-up execution by 7.5 minutes (>30%) while incurring only 37 seconds overhead for online learning.

数据库基数估算在线学习性能优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。