arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2205.05649cs.DBcs.DScs.LO
收藏

Any-k算法:用于枚举合取查询排序答案

Any-k Algorithms for Enumerating Ranked Answers to Conjunctive Queries

Nikolaos Tziavelis, Wolfgang Gatterbauer, Mirek Riedewald

AI总结:

提出any-k算法,通过下推排序到连接中,实现合取查询排序答案的高效枚举,复杂度为O(n+klogk),优于传统先连接后排序方法。

摘要:

我们研究了合取查询(CQs)的排序枚举问题,其中答案按给定的排序函数(例如SQL中的ORDER BY子句)排序。我们开发了“any-k”算法,该算法在不知道所需答案数量k的情况下,通过仔细排序中间元组的计算并将连接答案的物化推迟到需要时,将排序下推到连接中。为了实现这一点,排序函数需要满足特定类型的单调性。支持的排序函数包括常见的权重和(其中答案通过输入元组权重之和进行比较),以及任何可交换的选择性dioid。我们的结果扩展了一个著名的无排序枚举二分法,该二分法指出只有自由连接合取查询是可处理的(在特定硬度假设下且对于无自连接的CQs)。对于这类查询,设n表示输入大小,我们排序枚举方法到第k个CQ答案的时间数据复杂度为O(n+klogk),仅比O(n+k)的无排序枚举保证慢一个对数因子。我们工作的一个核心见解是,CQs的排序枚举与动态规划以及加权DAG中路径枚举的基本任务密切相关。我们揭示了一个先前未知的权衡:当返回答案数量较少时,一种any-k算法具有较低复杂度;而当答案数量较多时,另一种算法更优。在我们定义并利用的一种更严格的单调性属性下,这种权衡被消除,从而产生了一种新颖算法,该算法在渐近意义上优于所有先前已知的替代方案,包括Eppstein的权重和路径枚举算法。我们通过实验研究实证展示了理论分析的发现,突显了我们的方法优于现有数据库系统采用的先连接后排序方法。

英文摘要:

We study ranked enumeration for Conjunctive Queries (CQs) where the answers are ordered by a given ranking function (e.g., an ORDER BY clause in SQL). We develop "any-k" algorithms, which, without knowing the number k of desired answers, push down the ranking into joins by carefully ordering the computation of intermediate tuples and avoiding materialization of join answers until they are needed. For this to be possible, the ranking function needs to obey a particular type of monotonicity. Supported ranking functions include the common sum-of-weights, where answers are compared by the sum of input-tuple weights, as well as any commutative selective dioid. Our results extend a well-known unranked-enumeration dichotomy, which states that only free-connex CQs are tractable (under certain hardness hypotheses and for CQs without self-joins). For this class of queries and with n denoting the size of the input, the data complexity of our ranked enumeration approach for the time to the kth CQ answer is O(n+klogk), which is only a logarithmic factor slower than the O(n+k) unranked-enumeration guarantee. A core insight of our work is that ranked enumeration for CQs is closely related to Dynamic Programming and the fundamental task of path enumeration in a weighted DAG. We uncover a previously unknown tradeoff: one any-k algorithm has lower complexity when the number of returned answers is small, the other when their number is large. This tradeoff is eliminated under a stricter monotonicity property that we define and exploit for a novel algorithm that asymptotically dominates all previously known alternatives, including Eppstein's algorithm for sum-of-weights path enumeration. We empirically demonstrate the findings of our theoretical analysis in an experimental study that highlights the superiority of our approach over the join-then-rank approach that existing database systems follow.

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

↑