SafeBound:一个实用的基数界生成系统
SafeBound: A Practical System for Generating Cardinality Bounds
摘要:
最近的工作再次强调了基数估计对查询优化的重要性。虽然随着时间的推移,新技术的准确性不断提高,但它们通常仍然允许低估,这通常会导致优化器做出过于乐观的决策。对于昂贵的查询,这可能代价很高。另一种估计方法是基数边界,也称为悲观基数估计,其中基数估计器提供真实基数的保证上限。通过从不低估,这种方法允许优化器避免潜在的低效计划。然而,现有的悲观基数估计器还不实用:它们使用非常有限的数据统计数据,并且不能处理谓词。在本文中,我们介绍SafeBound,第一个实用的系统生成基数界限。SafeBound建立在最近的理论工作,使用连接属性的度序列来计算基数界限,扩展了这个框架与谓词,介绍了一个实用的压缩方法的度序列,并实现了一个有效的推理算法。在四个工作负载中,SafeBound实现了比PostgreSQL低80%的端到端运行时间,并且通过改进昂贵查询的运行时间,与最先进的基于ML的估计器和悲观基数估计器相当或更好。与最先进的基数估计方法相比,它还节省了高达500倍的查询规划时间,并使用了高达6.8倍的空间。
英文摘要:
Recent work has reemphasized the importance of cardinality estimates for query optimization. While new techniques have continuously improved in accuracy over time, they still generally allow for under-estimates which often lead optimizers to make overly optimistic decisions. This can be very costly for expensive queries. An alternative approach to estimation is cardinality bounding, also called pessimistic cardinality estimation, where the cardinality estimator provides guaranteed upper bounds of the true cardinality. By never underestimating, this approach allows the optimizer to avoid potentially inefficient plans. However, existing pessimistic cardinality estimators are not yet practical: they use very limited statistics on the data, and cannot handle predicates. In this paper, we introduce SafeBound, the first practical system for generating cardinality bounds. SafeBound builds on a recent theoretical work that uses degree sequences on join attributes to compute cardinality bounds, extends this framework with predicates, introduces a practical compression method for the degree sequences, and implements an efficient inference algorithm. Across four workloads, SafeBound achieves up to 80% lower end-to-end runtimes than PostgreSQL, and is on par or better than state of the art ML-based estimators and pessimistic cardinality estimators, by improving the runtime of the expensive queries. It also saves up to 500x in query planning time, and uses up to 6.8x less space compared to state of the art cardinality estimation methods.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。