Manuscript Offprint
arXiv:2610.10282Truly Sub- Min-Sum Subset Convolution and Join Ordering
Abstract
We present a deterministic reduction from min-sum subset convolution to min-plus matrix product. We show that if the min-plus product of two matrices with -bit integer entries can be computed in poly( , ) time for a fixed rational , then min-sum subset convolution on an n-element universe can be solved in poly( , ) time. Instantiating this reduction with the recent breakthrough on subcubic min-plus matrix product by Alman and Vassilevska Williams gives a Las Vegas algorithm with expected running time and a deterministic algorithm with running time , strictly breaking the longstanding computational barrier. Notably, these speedups translate directly to database query optimization, yielding the same expected and deterministic running-time bounds for join ordering under the cost function.
1 Introduction
Consider two functions . Their min-sum subset convolution is defined as:
A naive, direct evaluation inherently examines ordered disjoint pairs . Previous work by Björklund, Husfeldt, Kaski, and Koivisto [BHKK07] established a fast subset-convolution algorithm over rings, alongside an -time algorithm for min-sum subset convolution where integer values are strictly bounded in magnitude by . Stoian [Sto24] later conjectured that exact min-sum subset convolution could not achieve -time for any constant .
In the domain of database query optimization, this very primitive appears in the problem of join ordering, under the setting of bushy query plans, with many advances on the exact algorithm since the infancy of the field [SAC 79, CM95, VM96, MS96, Van98, OL90, MN06, MN08, HD23]. Stoian and Kipf [SK24] formalized this alignment in DPconv, demonstrating an exact algorithm for the objective that relies on the bounded-integer subset-convolution algorithm. While the running time of their algorithm for the alternative objective avoids the dependence on the largest cardinality W, their exact optimization exhibits a linear dependency in this parameter, namely .
Contribution. We introduce a deterministic reduction from min-sum subset convolution to min-plus matrix products. This reduction implies a truly sub- algorithm given the recent subcubic matrix product algorithm [AW26]. Crucially, our algorithm is exact, imposes no polynomial bound on the magnitude of the integer inputs, and has only polynomial dependence on their binary encoding length. We show that the similar time bound holds in the setting of join ordering via the connection established in [SK24]; similar improvements are natural to other problems, whose solutions use this primitive (see, e.g., [FK10, BHKK07, Sto24] for a few examples). Needless to say, the latter result, touching a fundamental problem in query optimization, comes as a (huge) surprise to the author.
Computational Model. Throughout, all finite values of the input functions and all cardinality estimates are integers represented in binary. Let bound their bit length. For subset convolution, the two input functions are supplied as explicit tables of values each; these tables may also contain the symbol . We use a random-access model and charge arithmetic according to operand bit length. All computations are exact, and polynomial factors in address length are included in the bounds. The notation suppresses factors polynomial in and , but never polynomial factors in the full -entry table size. A Las Vegas algorithm always returns the exact answer and has the stated expected running time.
Theorem 1 (Min-sum subset convolution). Fix a rational . Suppose the min-plus product of two integer matrices with -bit entries can be computed in poly( , ) time. Then min-sum subset convolution can be computed in time
A deterministic product algorithm gives a deterministic convolution algorithm. A Las Vegas product algorithm gives a Las Vegas convolution algorithm with the corresponding expected bound.
We prove Theorem 1 in Sec. 4. Combining it with the min-plus algorithms of Alman and Vassilevska Williams [AW26] yields the following bounds.
Corollary 2. Min-sum subset convolution on integer inputs can be computed by a Las Vegas algorithm in expected time and by a deterministic algorithm in time.
Corollary 3. The same bounds hold for join ordering under , provided each cardinality estimate can be obtained in time. For ordinary undirected query graphs, both bounds hold whether cross products are permitted or forbidden.
Our Lemma 8 (Appendix A) gives min-plus exponents 2.998 and 2.9995 for the Las Vegas and deterministic algorithms, respectively. Since Theorem 1 assumes an exponent of , we take
respectively. Substituting these values gives
In each case, the gap between the two constants absorbs the subexponential factor in Eq. (2). We justify the min-plus bounds in Sec. A and prove the join-ordering result in Sec. 5.
A prototype implementation is available at https://github.com/stoianmihail/LeDP.
To systematically divide the evaluation space, we introduce a secondary ordered partition of the universe, , which serves as a structural restriction on the valid candidates. Rather than representing physical subplans, these sets act as indexing filters that constrain element membership according to the following strict conditions:
| Restriction part | Allowed candidate memberships | Forbidden membership |
|---|---|---|
| (middle) | left child right child | outside set |
| (columns) | right child outside set | left child |
| (rows) | left child outside set | right child |
Formally, a candidate partition is compatible with a given restriction if and only if its forbidden intersections are empty, namely:
Lemma 4 (Restricted product). For a restriction , define matrices indexed by , , and :
The entry is the minimum of over all compatible candidates with .
Proof. For every middle index , the operands correspond to
The sets are disjoint and their union is . They satisfy Eq. (3). Conversely, any compatible candidate has the unique representation
Compatibility forces all of into , so . It also gives . Consequently, Eq. (4) enumerates precisely the compatible candidates, and taking the minimum proves the statement.
Let us see next a concrete example of this construction.
Example 5. Let , let , and consider the binary split and . The outside set is . Choose , , and . The row , middle index , and column produce exactly
With this, we can update the result of .
Lemma 6. Under the assumption of Theorem 1, let . All updates from one restriction can be computed in poly time. The same statement holds in expectation for a Las Vegas product algorithm.
Proof. The matrix dimensions in Eq. (4) are and . Tile the three index ranges into blocks of length . There are triples of blocks, each requiring one min-plus product. Their total running time is
Take entrywise minima over the inner blocks. The total number of entries read or updated over all block triples is , which is at most because . Note that index generation and table access add polynomial factors in . This argument also covers , when the square products have dimension one.
Resolution of Entries. The square matrix primitive requires only finite integer operands. Let bound the absolute values of all finite entries within and , substituting with the finite proxy . Consequently, the sum of any two valid finite entries lies in , whereas any sum incorporating a proxy replacement strictly exceeds . Following each matrix product, values exceeding are deterministically mapped back to . This replacement mechanism requires only bits and mathematically preserves the integrity of every valid update.
3 A Deterministic Covering Lemma
Write . For a restriction on a block of coordinates, set
A family is complete if every ordered partition of the block is compatible with some family member. Let .
Lemma 7 (Complete local covers). For every , one can deterministically construct in bit operations a complete family satisfying
The constants in the construction may depend on the fixed rational .
Proof. Consider the universe of candidate membership strings. For each restriction , let
be the set of candidates it covers.
For each candidate and each coordinate, exactly two restriction labels are compatible with its membership label. Consequently, every candidate belongs to exactly sets .
We first bound the total weight of all restrictions. For any fixed label , summing over all restriction strings gives : each coordinate contributes when assigned label and 1 for either of the other two labels. Therefore,
To implement the construction with finite precision, round each upward to a multiple of , for . Since , the rounded quantity lies between and . The resulting rational weights satisfy
Run weighted greedy set cover [Chv79]. Initially, all candidates are uncovered. At each step, let be the set of uncovered candidates and define
Choose a restriction minimizing among those with , add it to , and mark its covered candidates as covered. Continue until no uncovered candidate remains.
Suppose . Since every remaining candidate belongs to exactly sets , double counting gives
and, by averaging,
Set
If the greedy choice covers previously uncovered candidates when remain, its rounded weight is at most . Moreover,
Across all greedy steps, these summation ranges partition . Thus
which proves Eq. (6). The family is complete because the algorithm terminates only after covering every candidate.
Finally, there are restrictions and candidates. Explicit incidence enumeration and a direct implementation of greedy take time. All rounded weights have bits. For fixed rational , the rounded numerator of is
It can be computed by integer root comparison, by finding the smallest integer t such that
The integers involved have bits, with constants depending on the fixed . Hence the entire construction takes bit operations.
4 Truly Sub- Min-Sum Subset Convolution
Partition into disjoint coordinate blocks of sizes , where and . Construct the families of Lemma 7 for these sizes. Let consist of all restrictions obtained by choosing one member from each local family and concatenating them. The Cartesian product can be enumerated without materializing it.
For each restriction , let and be the matrices from Lemma 4; explicitly,
where , , and . Compute the min-plus product
which is a matrix, with rows indexed by and columns indexed by . Its entries are
For fixed U, V, each choice of T specifies a binary split
of the same output set . By Lemma 4, these are precisely the splits of compatible with . Thus is the minimum cost among those splits and supplies an update to .
Initialize every entry of to . For each , compute and perform
for all its row and column indices.
Proof of Theorem 1. Every matrix update uses a valid disjoint pair, by Lemma 4. Conversely, fix any disjoint pair and put . On each coordinate block, completeness supplies a compatible local restriction. Their concatenation belongs to and is compatible with . Thus every candidate is considered at least once. Repeated candidates cause no difficulty because the minimum operation is idempotent. The returned table is exactly , as in Eq. (1).
It remains to bound all work, including unbalanced restrictions. Since , Lemma 6 and
give, after suppressing a common poly factor,
(7)
The equality in the second line is the distributive identity for the Cartesian product of local families. It imposes no balance condition on X, Y, Z. In the last line we use .
The covers take poly(n) time to construct, and initialization and index generation do not affect the bound. If the matrix algorithm is Las Vegas, the same calculation gives the expected running time by linearity of expectation. Every matrix product is computed exactly, so the convolution is exact as well.
Note that a candidate partition where and requires in every compatible restriction. Such extreme candidates would be omitted by a covering family restricted to equal-sized parts. Consequently, the weighted summation in Eq. (7) accounts for all restriction shapes, explicitly including empty parts.
5 Application: Join Ordering
We apply our subset-convolution algorithm to the layer-wise dynamic program of Stoian and Kipf [SK24, Sec. 3.1]. We call the resulting algorithm LeDP; the change from DPconv is the computation of min-sum subset convolution described in Sec. 4.
Let index the base relations. For every nonempty , let be its nonnegative cardinality estimate. The estimates are supplied as a table, or each can be obtained in poly time. A query plan is a full binary tree whose leaves are the relations, each appearing once. An internal node with leaf set contributes to the objective .
The well-known dynamic programming recurrence is
Proof of Corollary 3. Initialize OPT( ) = 0 for every . For , define
Compute and set
Every proper nonempty child of such an has size less than , and the empty set has infinite value in . Induction on therefore gives Eq. (8).
There are convolution calls. Since a plan has internal nodes, every finite DP value is at most and has bits.
To forbid cross products in an ordinary undirected query graph, keep whenever the induced subgraph on S is disconnected, and update only connected sets. If two connected children A, B have a connected union, an edge must cross from A to B. Thus every finite transition is a valid non-Cartesian join. Conversely, every cross-product-free binary plan has connected leaf sets at all nodes, so no such plan is excluded. Testing connectivity for all subsets takes poly(n) time.
If , no permitted plan exists. Otherwise, reconstruct an optimal plan as in [SK24, Alg. 2]: at each nonsingleton set S, find a proper nonempty subset A satisfying
and recurse on the two children. There are at most such searches, each examining at most subsets, so reconstruction takes poly time.
Applying Corollary 2 to the convolution calls gives expected Las Vegas time and deterministic time.
AI Story. We used ChatGPT-6 Astra {xhigh,max} to develop the algorithm behind min-sum subset convolution once we learned about the breakthrough in [AW26]. We hinted the model at the list-and-split technique developed in [Wil05]. The author takes full responsibility for the content of this paper.
References
[AW26] Josh Alman and Virginia Vassilevska Williams. Truly Subquadratic 3SUM and Truly Subcubic APSP via Triangles in Sparse Lopsided Graphs, 2026. URL: https://arxiv.org/abs/2610.06783, arXiv:2610.06783.
[BHKK07] Andreas Björklund, Thore Husfeldt, Petteri Kaski, and Mikko Koivisto. Fourier meets Möbius: fast subset convolution. In David S. Johnson and Uriel Feige, editors, Proceedings of the 39th Annual ACM Symposium on Theory of Computing, San Diego, California, USA, June 11-13, 2007, pages 67–74. ACM, 2007. doi:10.1145/1250790.1250801.
[Chv79] Vasek Chvátal. A Greedy Heuristic for the Set-Covering Problem. Math. Oper. Res., 4(3):233–235, 1979. URL: https://doi.org/10.1287/moor.4.3.233, doi:10.1287/MOOR.4.3.233.
[CM95] Sophie Cluet and Guido Moerkotte. On the complexity of generating optimal left-deep processing trees with cross products. In Georg Gottlob and Moshe Y. Vardi, editors, Database Theory - ICDT'95, 5th International Conference, Prague, Czech Republic, January 11-13, 1995, Proceedings, volume 893 of Lecture Notes in Computer Science, pages 54–67. Springer, 1995. doi:10.1007/3-540-58907-4_6.
[CVX22] Timothy M. Chan, Virginia Vassilevska Williams, and Yinzhan Xu. Hardness for triangle problems under even more believable hypotheses: reductions from real apsp, real 3sum, and OV. In Stefano Leonardi and Anupam Gupta, editors, STOC '22: 54th Annual ACM SIGACT Symposium on Theory of Computing, Rome, Italy, June 20 - 24, 2022, pages 1501–1514. ACM, 2022. doi:10.1145/3519935.3520032.
[FK10] Fedor V. Fomin and Dieter Kratsch. Exact Exponential Algorithms. Springer-Verlag, Berlin, Heidelberg, 1st edition, 2010.
[HD23] Immanuel Haffner and Jens Dittrich. Efficiently computing join orders with heuristic search. Proc. ACM Manag. Data, 1(1):73:1–73:26, 2023. doi:10.1145/3588927.
[MN06] Guido Moerkotte and Thomas Neumann. Analysis of two existing and one new dynamic programming algorithm for the generation of optimal bushy join trees without cross products. In Umeshwar Dayal, Kyu-Young Whang, David B. Lomet, Gustavo Alonso, Guy M. Lohman, Martin L. Kersten, Sang Kyun Cha, and Young-Kuk Kim, editors, Proceedings of the 32nd International Conference on Very Large Data Bases, Seoul, Korea, September 12-15, 2006, pages 930–941. ACM, 2006. URL: http://dl.acm.org/citation.cfm?id=1164207.
[MN08] Guido Moerkotte and Thomas Neumann. Dynamic programming strikes back. In Jason Tsong-Li Wang, editor, Proceedings of the ACM SIGMOD International Conference on Management of Data, SIGMOD 2008, Vancouver, BC, Canada, June 10-12, 2008, pages 539–552. ACM, 2008. doi:10.1145/1376616.1376672.
[MS96] Guido Moerkotte and Wolfgang Scheufele. Constructing optimal bushy processing trees for join queries is np-hard. Technical report, 1996.
[OL90] Kiyoshi Ono and Guy M. Lohman. Measuring the complexity of join enumeration in query optimization. In Dennis McLeod, Ron Sacks-Davis, and Hans-Jörg Schek, editors, 16th International Conference on Very Large Data Bases, August 13-16, 1990, Brisbane, Queensland, Australia, Proceedings, pages 314–325. Morgan Kaufmann, 1990. URL: http://www.vldb.org/conf/1990/P314.PDF.
[SAC 79] Patricia G. Selinger, Morton M. Astrahan, Donald D. Chamberlin, Raymond A. Lorie, and Thomas G. Price. Access path selection in a relational database management system. In Philip A. Bernstein, editor, Proceedings of the 1979 ACM SIGMOD International Conference on Management of Data, Boston, Massachusetts, USA, May 30 - June 1, pages 23–34. ACM, 1979. doi:10.1145/582095.582099.
[SK24] Mihail Stoian and Andreas Kipf. DPconv: Super-Polnomially Faster Join Ordering. Proc. ACM Manag. Data, 2(6):234:1–234:26, 2024. doi:10.1145/3698809.
[Sto24] Mihail Stoian. Approximate Min-Sum Subset Convolution. In Marcin Bienkowski and Matthias Englert, editors, Approximation and Online Algorithms - 22nd International Workshop, WAOA 2024, Egham, UK, September 5-6, 2024, Proceedings, volume 15269 of Lecture Notes in Computer Science, pages 198–212. Springer, 2024. doi:10.1007/978-3-031-81396-2_14.
[Van98] Bennet Vance. Join-order Optimization with Cartesian Products. PhD thesis, Oregon Graduate Institute of Science and Technology, 1998.
[VM96] Bennet Vance and David Maier. Rapid Bushy Join-order Optimization with Cartesian Products. In H. V. Jagadish and Inderpal Singh Mumick, editors, Proceedings of the 1996 ACM SIGMOD International Conference on Management of Data, Montreal, Quebec, Canada, June 4-6, 1996, pages 35–46. ACM Press, 1996. doi:10.1145/233269.233317.
[Wil05] Ryan Williams. A new algorithm for optimal 2-constraint satisfaction and its implications. Theor. Comput. Sci., 348(2-3):357–365, 2005. doi:10.1016/j.tcs.2005.09.023.
A Instantiating the Min-Plus Primitive
The following lemma records the bit-complexity bounds obtained from the algorithms of Alman and Vassilevska Williams [AW26]. Part (i) follows by analyzing their real-valued algorithm (Theorem 35) on integer inputs. For part (ii), their Theorem 22 gives the deterministic bound for polynomially bounded weights; the proof below extends its analysis to arbitrary -bit integers.
Lemma 8 (Bit complexity of min-plus product). The min-plus product of two matrices with -bit integer entries can be computed:
(i) by a Las Vegas algorithm in expected time poly( , );
(ii) by a deterministic algorithm in time poly( , ).
Both algorithms return the exact product.
Proof. For (i), use Theorem 35 of [AW26]. Although stated on a real RAM, its input-dependent arithmetic uses sums and differences of a constant number of original entries, together with comparisons; see their Lemmas 36(a) and 37 and the reductions of [CVX22]. These values have bits. The auxiliary counting computations use integers of bits, as in their Section 4.3. Accounting for bit arithmetic multiplies the stated expected running time by at most .
For (ii), their Theorem 22 assumes polynomially bounded weights, so we must retain the weight dependence in its proof. Their deterministic min-plus algorithm reduces to Exact Triangle, which asks whether an edge-weighted graph contains a triangle of total weight zero. We check the bit-length dependence of this intermediate algorithm.
Consider an Exact Triangle instance with vertices per part and weights of absolute value below . In the prime-hashing argument of their Theorem 17, a nonzero triangle sum has absolute value below . It is therefore divisible by at most primes in , where is their auxiliary dimension. The same averaging argument shows that the deterministically selected prime has at most
false positives. Their witness search consequently performs at most
checks.
Take and , as in the first construction of their Theorem 19. Arithmetic on original weights has polynomial cost in , while the auxiliary counting computations use -bit integers. The remaining analysis is unchanged, giving
The reduction in their Theorem 21(b) then gives min-plus product in
time. Since , this proves (ii).
Proof of Corollary 2. By Lemma 8, we can apply Theorem 1 with
for the Las Vegas and deterministic algorithms, respectively. The resulting bases satisfy
Since both inequalities are strict, the subexponential factor in Eq. (2) is absorbed into the larger bases. This gives expected Las Vegas time and deterministic time.