We study the problem of enumerating answers of Conjunctive Queries ranked according to a given ranking function. Our main contribution is a novel algorithm with small preprocessing time, logarithmic delay, and non-trivial space usage during execution. To allow for efficient enumeration, we exploit certain properties of ranking functions that frequently occur in practice. To this end, we introduce the notions of {\em decomposable} and {\em compatible} (w.r.t. a query decomposition) ranking functions, which allow for partial aggregation of tuple scores in order to efficiently enumerate the output. We complement the algorithmic results with lower bounds that justify why restrictions on the structure of ranking functions are necessary. Our results extend and improve upon a long line of work that has studied ranked enumeration from both a theoretical and practical perspective.
Let's Play Tag: Linear Time Evaluation of Conjunctive Queries under TGD Constraints
Inria, LIRMM, University of Montpellier, CNRS(法国国家信息与自动化研究所、LIRMM、蒙彼利埃大学、法国国家科学研究中心);Leipzig University(莱比锡大学);Center for Scalable Data Analytics and Artificial Intelligence (ScaDS.AI)(可扩展数据分析与人工智能中心);Warsaw University(华沙大学)
Beyond Equi-joins: Ranking, Enumeration and Factorization
我们研究θ-连接一般和连接谓词与合取和析取的不平等,特别是,重点排名枚举的答案是递增返回的顺序由给定的排名功能。我们的方法实现了强大的时间和空间复杂度的属性:$n$表示数据库中的元组的数量,我们保证非循环的全连接查询与不等式条件,对于每个值的$k$,$k$排名靠前的答案返回$\mathcal{O}(n \operatorname{polylog} n + k \log k)$时间。这在$\mathcal{O}(n + k \log k)$的多对数因子内,即,最为人所知的等价连接的复杂性,甚至是$\mathcal{O}(n+k)$的复杂性,即,查看输入并以任何顺序返回$k$答案所需的时间。我们的保证扩展到连接查询的选择和许多类型的投影(即那些所谓的“自由连接”查询和那些使用包语义)。值得注意的是,对于$\ell$关系的连接,即使连接结果的数量为$n^\ell$,它们也成立。的关键成分是一种新的$\mathcal{O}(n \operatorname{polylog} n)$ -大小因式分解表示的查询输出,这是构建在一个给定的查询和数据库的飞行。除了提供第一个非平凡的理论保证超越equi-joins,我们在实验研究中表明,我们的排名枚举方法也是内存效率和速度在实践中,击败国家的最先进的数据库系统的运行时间的数量级。