arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.05912cs.DB
收藏

LpBound:利用度序列的 $\ell_p$-范数进行悲观基数估计

LpBound: Pessimistic Cardinality Estimation using $\ell_p$-Norms of Degree Sequences

Haozhe Zhang, Christoph Mayer, Mahmoud Abo Khamis, Dan Olteanu, Dan Suciu

AI总结:

本文提出悲观基数估计器 LpBound,利用度序列的 $\ell_p$-范数构造线性规划上界,在 JOB、STATS 和子图匹配基准上以低开销实现比传统估计器高几个数量级的准确度,并能改进 Postgres 查询计划。

摘要:

基数估计是指在不对查询进行实际求值的情况下,估计查询输出大小的问题。基数估计器是查询优化器中的关键组成部分,并且当优化器选择出较差的执行计划时,基数估计器往往是主要原因。本文介绍了 LpBound,这是一种针对带有选择谓词和分组依据子句的多连接查询(无环或有环)的悲观基数估计器。LpBound 利用输入关系上的简单统计信息(即度序列的 $\ell_p$-范数)来计算查询输出大小的保证上界。该上界是一个线性规划的最优解,其约束条件编码了数据统计信息和 Shannon 不等式。我们引入了两种利用查询结构来加速估计时间并使 LpBound 具有实用性的优化方法。我们在 JOB、STATS 和子图匹配基准上,将 LpBound 与一系列传统、悲观和基于机器学习的估计器进行了实验评估。我们的主要发现是,LpBound 的准确度可以比主流开源和商业数据库系统中使用的传统估计器高出几个数量级,同时其估计时间和空间需求保持在可比的较低水平。当注入 LpBound 的估计值时,Postgres 推导出的查询计划至少与使用真实基数推导出的计划一样好。

英文摘要:

Cardinality estimation is the problem of estimating the size of the output of a query, without actually evaluating the query. The cardinality estimator is a critical piece of a query optimizer, and is often the main culprit when the optimizer chooses a poor plan. This paper introduces LpBound, a pessimistic cardinality estimator for multijoin queries (acyclic or cyclic) with selection predicates and group-by clauses. LpBound computes a guaranteed upper bound on the size of the query output using simple statistics on the input relations, consisting of $\ell_p$-norms of degree sequences. The bound is the optimal solution of a linear program whose constraints encode data statistics and Shannon inequalities. We introduce two optimizations that exploit the structure of the query in order to speed up the estimation time and make LpBound practical. We experimentally evaluate LpBound against a range of traditional, pessimistic, and machine learning-based estimators on the JOB, STATS, and subgraph matching benchmarks. Our main finding is that LpBound can be orders of magnitude more accurate than traditional estimators used in mainstream open-source and commercial database systems. Yet it has comparable low estimation time and space requirements. When injected the estimates of LpBound, Postgres derives query plans at least as good as those derived using the true cardinalities.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑