arXiv:2610.39311cs.DSOct 2026

Manuscript Offprint

arXiv:2610.39311

Tight Asymptotic Bounds on the Size of Order Graphs

Ruben Becker, Adrián Gómez-Brandón, Gonzalo Navarro, Nicola Prezza

Abstract

Order graphs were introduced by Arroyuelo et al. (TODS 2024) as a generalization of the ring index, to support worst-case optimal joins on relations of arity dd while storing as few columns as possible: the index stores one column per edge, so its size is proportional to the number of edges of an order graph. It was known that the minimum number of edges lies between Ω(2dd)\Omega(2^d\sqrt{d}) and O(2dd)O(2^d d), and the lower bound had been claimed to be 42 for d=6d=6. We first exhibit an order graph with only 40 edges for d=6d=6, and show that the proof of that lower bound holds only for unions of cycles, whereas order graphs can be smaller than the smallest set of cycles. We give a corrected statement and proof that holds for every order graph: there must be at least max⁡m(dm)⌈m/2⌉\max_m \binom{d}{m} \lceil m/2 \rceil edges. This bound is 40 for d=6d=6, so our 40-edge graph is optimal. We then settle the asymptotic question: the minimum size is Θ(2dd)\Theta(2^d\sqrt{d}). This is obtained via an explicit construction, based on symmetric chain decompositions of the Boolean lattice, with at most (d−1)(d⌊d/2⌋)+2d(d-1)\binom{d}{\lfloor d/2 \rfloor} + 2^d edges. The upper bound is within a factor 4+O(d−1/2)4+O(d^{-1/2}) of the lower bound, and both numerically and asymptotically better than trie switching.

1 Introduction

Worst-case optimal joins and their space problem. A multijoin algorithm is worst-case optimal (wco) if it runs in time proportional to the AGM bound Q∗Q^* [3], the largest possible output of the query on databases of the given size. Classic multijoin algorithms that join two tables at a time are not wco, as they can produce intermediate results that are asymptotically larger than Q∗Q^* [3]. Since the first wco algorithm [6], Leapfrog TrieJoin (LTJ) [7] has become a reference wco algorithm because of its simplicity. Instead of joining tables pairwise, LTJ “binds” one join attribute at a time: at each step, every joined relation that contains the next attribute xx must be able to search the values of xx compatible with the attributes already bound. With classical prefix-based indexes (tries, B-trees), this requires the bound attributes to form a prefix of an indexed order, followed by xx. Supporting every binding order thus requires up to d!d! orders for a relation of arity dd, or the equivalent of 2d−12^{d-1} tries with the trie switching technique on meta-tries [1, Lemma 7.8]. Since the tries have dd levels, they store in the worst case d!(dN)d! (dN) values for a table of NN tuples, or 2d−1(dN)2^{d-1}(dN) with trie switching. This is much more than the dNdN values needed to store the table in plain form.

The ring. The ring [2, 1] avoids this redundancy. It stores each attribute as a separate column, sorted by a stable re-sort of a “previous” one, which allows the rows of any column to be mapped to those of the next efficiently without pointers. For d≤3d \leq 3, a single ring with dd columns supports LTJ in wco time over every binding order, using essentially the same dNdN values of storage required anyway to store the table in plain form. The key property is that, regarded cyclically and in both directions, a sequence of the d≤3d \leq 3 attributes contains every possible binding sequence: any subset of already bound attributes can be extended to contain the new attribute xx to bind, either backwards or forwards. The ring exploits this fact by always maintaining a range of some column that represents the current node of any of the d!d! tries along the LTJ algorithm.

From rings to order graphs. For d>3d > 3 a single ring no longer suffices; for example with attributes A,B,C,DA, B, C, D, the circular string ABCDABCD does not contain the substring ACAC (nor CACA); we need two rings like A,B,C,DA, B, C, D and A,C,B,DA, C, B, D to do the trick. The natural question is: how many rings are needed with dd attributes? It was proved that O(2d)O(2^d) rings, thereby using O(2d(dN))O(2^d(dN)) space, were sufficient to support LTJ [1], which puts the ring in the same asymptotic family of trie switching.

Arroyuelo et al. [1] then generalized sets of rings to order graphs: directed graphs whose nodes are attribute orders, where an edge labeled by attribute aa goes from an order π\pi to the order obtained by stably re-sorting π\pi by aa (that is, by moving aa to the front). For that edge, the index stores the column aa of the table, in the order that results from lexicographically sorting the table rows with the attributes reordered as π\pi (several edges may be labeled aa, so the index will store several copies of column aa, with orders given by different π\pis). To support LTJ in wco time, an order graph must be complete: for every set SS of bound attributes and every next attribute xx, the graph must contain a path labeled by S∪{x}S \cup \{x\} with xx at one end [1, Thm. 7.4]. Since the index stores a column (NN values) per graph edge, the central combinatorial question is:

What is the minimum number of edges of a complete order graph of dimension dd?

A set of rings is an order graph formed by various length-dd cycles, but complete order graphs can be strictly smaller: for d=5d = 5, a single cycle of length 20 is complete, whereas 5 rings (25 edges) are needed if only rings of length dd are used.

The lower bound. The minimum size of a complete order graph was shown to lie between Ω(2dd)\Omega(2^d \sqrt{d}) [1, Thm. 7.9] and O(2dd)O(2^d d) (from the O(2d)O(2^d) rings). Exhaustive combinatorial exploration, mostly restricted to cycles and sets of rings, found that the minimal complete order graphs for d≤6d \leq 6 matched the numerical lower bound [1, Thm. 7.9], including a cyclic graph of size 42 for d=6d = 6. These numbers are much smaller than the sizes of trie switching, which backed the conjecture that the actual size is closer to 2dd2^d \sqrt{d} than to the 2d−1d2^{d-1}d of trie switching, and thus order graphs are indeed superior. But the conjecture remained unproved.