Ranked Enumeration of Conjunctive Query Results
Shaleen Deep, Paraschos Koutris
TL;DR
This work tackles ranked enumeration of full Conjunctive Queries (CQs) over relational databases, addressing the inefficiencies of materializing and sorting all results. It introduces ranking function properties—decomposable and compatible—with respect to query decompositions, and proves a main theorem that yields preprocessing time $O(|D|^{fhw})$ and enumeration delay $O(\log|D|)$ when rank is compatible. The framework supports several ranking families (vertex-based, tuple-based, lexicographic, and bounded) and extends to UCQs and submodular-width-based improvements, while establishing lower bounds that delineate the necessity of structure in the ranking function. The results advance ranked-enumeration theory and offer practical implications for scalable top-$k$ CQ evaluation, with potential extensions to dynamic settings and broader query families.
Abstract
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.
