[Paper Review] Optimal Algorithms for Ranked Enumeration of Answers to Full Conjunctive Queries
This paper presents optimal algorithms for ranked enumeration of answers to full conjunctive queries (CQs), including cyclic ones, by generalizing dynamic programming problems via selective dioids. It extends k-shortest path algorithms to achieve optimal time to first result and minimal delay between results under data complexity, outperforming batch methods even when all results are produced, with theoretical and empirical validation across diverse query types.
We study ranked enumeration of join-query results according to very general orders defined by selective dioids. Our main contribution is a framework for ranked enumeration over a class of dynamic programming problems that generalizes seemingly different problems that had been studied in isolation. To this end, we extend classic algorithms that find the k-shortest paths in a weighted graph. For full conjunctive queries, including cyclic ones, our approach is optimal in terms of the time to return the top result and the delay between results. These optimality properties are derived for the widely used notion of data complexity, which treats query size as a constant. By performing a careful cost analysis, we are able to uncover a previously unknown tradeoff between two incomparable enumeration approaches: one has lower complexity when the number of returned results is small, the other when the number is very large. We theoretically and empirically demonstrate the superiority of our techniques over batch algorithms, which produce the full result and then sort it. Our technique is not only faster for returning the first few results, but on some inputs beats the batch algorithm even when all results are produced.
Motivation & Objective
- To address the open problem of efficient ranked enumeration for full conjunctive queries, especially cyclic ones, where results must be returned in order of a given ranking function.
- To unify disparate approaches to ranked query evaluation under a single theoretical framework based on selective dioids and dynamic programming.
- To achieve optimality in data complexity—treating query size as constant—by minimizing both the time to first result and the delay between subsequent results.
- To resolve the trade-off between two enumeration strategies: one efficient for small k, the other for large k, by formally characterizing their asymptotic behavior.
- To demonstrate superiority over batch algorithms that compute and sort the full result set, showing performance gains even in the all-results case.
Proposed method
- The framework generalizes classic k-shortest path algorithms to handle full conjunctive queries under selective dioids, which define the ranking semantics.
- It introduces a tree-based factorization of the query plan that respects lexicographic ordering and minimizes representation bloat, using a linear-time restructuring procedure.
- The approach uses dynamic programming with priority queues to enumerate results in ranked order, maintaining optimal delay and time to first result.
- It formalizes a trade-off between two enumeration strategies: one based on early pruning and one on efficient intermediate result propagation, with complexity depending on the number of results k.
- The method supports both acyclic and cyclic CQs, with optimality proven via fractional edge cover analysis and cost modeling in the RAM model.
- A preprocessing phase computes a compact, lexicographically ordered factorized representation to enable efficient enumeration with logarithmic delay.
Experimental results
Research questions
- RQ1Can we design a ranked enumeration algorithm for full conjunctive queries that achieves optimal time to first result and minimal delay between results under data complexity?
- RQ2How do different enumeration strategies—optimized for small vs. large k—compare asymptotically, and can we formally characterize their trade-offs?
- RQ3Can we unify seemingly unrelated approaches to ranked query evaluation (e.g., top-k joins, subgraph pattern ranking) under a single theoretical framework?
- RQ4Is it possible to beat the performance of batch algorithms (full join + sort) not only for top-k but also for full result enumeration?
- RQ5Can we extend existing optimal join algorithms to support ranked enumeration with the same optimality guarantees?
Key findings
- The proposed algorithm returns the top-ranked result in O(n^{1.5}) time for the 4-cycle query, matching the best-known bound for the Boolean version, despite the top-k problem being seemingly harder.
- For full conjunctive queries, the algorithm achieves optimal time to first result (TTF) and optimal delay between results (TTL), with TTF matching the best-known bounds for Boolean queries.
- The method outperforms batch algorithms even when all results are required, demonstrating that incremental enumeration is faster than full materialization and sorting on certain inputs.
- A previously unknown trade-off is uncovered: one approach is optimal for small k, the other for large k, with the optimal choice depending on the expected number of results.
- The framework supports both acyclic and cyclic queries, including those with fractional edge cover number ρ* = 2, such as the 4-cycle, and maintains optimality across all cases.
- The preprocessing step for factorized representations runs in O(n) time, and enumeration proceeds with logarithmic delay, enabling efficient streaming of results.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.