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

高效计算合取查询的差集

Computing the Difference of Conjunctive Queries Efficiently

Xiao Hu, Qichen Wang

AI总结:

针对合取查询差集计算,本文利用查询结构下推差集算子,给出一大类查询的线性时间算法及困难性结果,并用启发式规则和实验证明其相对 SQL 引擎的数量级加速。

摘要:

我们研究如何高效计算两个(或多个)合取查询的差集结果,这是关系代数中最后一个尚未被充分阐明的算子。实际数据库系统中的标准方法是将每个输入查询的结果物化为一个独立集合,然后计算两个(或多个)集合的差集。该方法受限于单独评估每个输入查询的复杂度,尤其当差集中只有少量结果时,代价可能非常高昂。本文中,我们提出一种新方法:利用输入查询的结构性质,重写原始查询,尽可能将差集算子下推。我们证明,对于一大类差集查询,该方法可产生按输入规模和(最终)输出规模(即从差集算子中保留下来的查询结果数量)计的线性时间算法。我们还证明了其余差集查询在线性时间内计算的困难性,从而补全了这一结果。尽管一般情况下难以实现线性时间算法,我们仍提供了若干启发式方法,可证明地改进标准方法。最后,我们在图数据集和基准数据集上将该方法与标准 SQL 引擎进行比较。实验结果表明,与原生 SQL 相比,我们的方法实现了数量级的加速。

英文摘要:

We investigate how to efficiently compute the difference result of two (or multiple) conjunctive queries, which is the last operator in relational algebra to be unraveled. The standard approach in practical database systems is to materialize the results for every input query as a separate set, and then compute the difference of two (or multiple) sets. This approach is bottlenecked by the complexity of evaluating every input query individually, which could be very expensive, particularly when there are only a few results in the difference. In this paper, we introduce a new approach by exploiting the structural property of input queries and rewriting the original query by pushing the difference operator down as much as possible. We show that for a large class of difference queries, this approach can lead to a linear-time algorithm, in terms of the input size and (final) output size, i.e., the number of query results that survive from the difference operator. We complete this result by showing the hardness of computing the remaining difference queries in linear time. Although a linear-time algorithm is hard to achieve in general, we also provide some heuristics that can provably improve the standard approach. At last, we compare our approach with standard SQL engines over graph and benchmark datasets. The experiment results demonstrate order-of-magnitude speedups achieved by our approach over the vanilla SQL.

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

↑