arXiv:2610.05440cs.DBOct 2026

Manuscript Offprint

arXiv:2610.05440

Guanaco: A Global-Uniformity Algorithm for Near-Submodular-Width Conjunctive Query Evaluation

Mahmoud Abo Khamis, Hubie Chen

MAHMOUD ABO KHAMIS, University of Oxford, UK

HUBIE CHEN, King's College London, UK

We present Guanaco, an algorithm for performing conjunctive query evaluation where, for each Boolean conjunctive query, and positive epsilon, the algorithm achieves polynomial time with exponent equal to the submodular width plus epsilon. The algorithm and its running time generalize smoothly to general conjunctive queries. We believe the algorithm and its analysis to be notably simple, indeed, together we believe they form a highly simple argument that conjunctive query evaluation can be performed in essentially submodular width time. In the case of Boolean conjunctive queries, the algorithm is based on interleaving three simple primitives: a subroutine for establishing a form of consistency; a subroutine for establishing global uniformity, which, briefly speaking, partitions relations as needed to control discrepancies between average degree and maximum degree; and, a simple step that joins pairs of existing relations to form new relations.

CCS Concepts: • Theory of computation → Database query processing and optimization (theory); • Information systems → Join algorithms.

Additional Key Words and Phrases: conjunctive queries; submodular width; uniformity

1 Introduction

Background. Conjunctive queries are frequently occurring and heavily studied database queries [1, 27], and the computational problem of evaluating a conjunctive query on a relational database—known as conjunctive query evaluation—is intensely studied in databases and in computer science at large [15, 27]. Indeed, this problem can be viewed as a formulation of the constraint satisfaction problem [12, 23], and overall has been studied from a multitude of motivations and perspectives [1, 4, 12, 13, 16–19, 21, 22, 24–27].

It is now well-known that for each conjunctive query, there exists a polynomial-time algorithm for query evaluation, that is, there exists a value α≥1\alpha \geq 1 and a query evaluation algorithm with running time O(Nα)O(N^{\alpha}), where NN denotes the input database size. Given the centrality of this evaluation problem, a number of works have sought to obtain a fine-grained understanding of the minimum exponent α\alpha achievable for each conjunctive query. While there is not yet a comprehensive understanding thereof, a number of recent works have shown general upper bounds in terms of the submodular width, a hypergraph measure that was introduced by Marx [26] and is based on the notion of submodularity. We focus our discussion on Boolean conjunctive queries, although the algorithms we discuss can operate on general conjunctive queries. We use HH to denote the hypergraph underlying conjunctive queries under discussion.

  • Building on an algorithm and analysis in Marx’s original article [26] introducing submodular width, Berkholz and Schweikardt [10] presented an algorithm, which (following [2]) we call the Marx-Berkholz-Schweikardt algorithm. This algorithm achieves, for each conjunctive query and ϵ>0\epsilon > 0, a runtime of O(N2⋅subw(H)+ϵ)O(N^{2 \cdot \text{subw}(H) + \epsilon}). Main ingredients used by this algorithm include two notions of consistency and a general procedure that partitions relations to enforce uniformity, which (briefly) means that the discrepancy between average degree and maximum degree, in relations, is controlled.

Authors' Contact Information: Mahmoud Abo Khamis, mahmoud.abokhamis@cs.ox.ac.uk, University of Oxford, Oxford, UK; Hubie Chen, hubie.chen@kcl.ac.uk, King's College London, London, UK.

Mahmoud Abo Khamis and Hubie Chen

• Abo Khamis, Ngo, and Suciu [5, 6] presented an information-theoretic algorithm called PANDA that achieves a runtime of O(Nsubw(Q)⋅polylog(N))O(N^{\text{subw}(Q)} \cdot \text{polylog}(N)). Subsequently, they introduced an improved version of the algorithm, called PANDAExpress [7] that mitigates the polylog(N) factor to leave only a single log⁡(N)\log(N), that is, that runs in time O(Nsubw(Q)⋅log⁡(N))O(N^{\text{subw}(Q)} \cdot \log(N)).

• Abo Khamis and Chen [2] presented an algorithm called Jaguar achieving, for each ϵ>0\epsilon > 0, a runtime of O(Nsubw(H)+ϵ)O(N^{\text{subw}(H)+\epsilon}). This algorithm, throughout an execution, maintains a set function defined on all variable subsets and reasons about submodularity to guide a process of computing joins and partitioning relations.

On a high level, these algorithms collectively make use of similar computational primitives, namely, consistency/semijoin reduction, computing joins to introduce new relations, and data partitioning. This consensus suggests that a submodular-width runtime is a natural barrier for algorithms employing these primitives. Related to this, Fan, Koutris, and Zhao [14] presented techniques for lower bounding the runtime of conjunctive query evaluation, and showed that, for a number of different conjunctive queries, no combinatorial algorithm can achieve runtime O(Nsubw(H)−ϵ)O(N^{\text{subw}(H)-\epsilon}), assuming established fine-grained complexity-theoretic hypotheses.

Contributions. In this article, we build on the notions, algorithms, and analyses of Marx [26] and Berkholz and Schweikardt [10] to give a new algorithm for conjunctive query evaluation that achieves, for each ϵ>0\epsilon > 0, a runtime of O(Nsubw(H)+ϵ)O(N^{\text{subw}(H)+\epsilon}). We believe our algorithm, called Guanaco, and its analysis to be remarkably simple, and to show a novel way in which the basic ingredients used by the above algorithms can be plainly combined to achieve conjunctive query evaluation in essentially submodular-width time. Indeed, we believe that the algorithm and analysis constitute one of the simplest explanations for showing the claimed time bound on conjunctive query evaluation, and could be used for teaching this query evaluation result.

In the Boolean case, the algorithm is based on interleaving three basic and generic primitives: a subroutine for establishing a form of consistency; a subroutine for establishing global uniformity, which reduces skew between average degree and maximum degree; and a simple step that joins pairs of existing relations to form new relations. In the general case, a version of the well-known Yannakakis algorithm for finding answers to acyclic conjunctive queries is also employed. In contrast to the PANDA family of algorithms and the Jaguar algorithm, the execution of Guanaco is not guided explicitly by submodularity or polymatroids. In terms of its use of submodularity, Guanaco only requires knowing the fixed value of the submodular width, but does not need to know how this value was computed.

Recent work introduced a hypergraph measure called ω\omega-submodular width [3] which, by leveraging algorithms for fast matrix multiplication, can for some hypergraphs achieve runtimes strictly below the submodular width. We believe that Guanaco, with its high simplicity, may be a fruitful footing for further investigating how to combine algebraic methods with the computational primitives used for submodular-width-based algorithms for conjunctive query evaluation.