Gradient-Based Join Ordering

Tim Schwabe, Maribel Acosta
11/18/2025
cs.DBcs.LG

No official code found. Best implementation: TimEricSchwabe/GBJO (1 star, last commit 2025-11-14).

Abstract

Join ordering is the NP-hard problem of selecting the most efficient sequence in which to evaluate joins (conjunctive, binary operators) in a database query. As the performance of query execution critically depends on this choice, join ordering lies at the core of query optimization. Traditional approaches cast this problem as a discrete combinatorial search over binary trees guided by a cost model, but they often suffer from high computational complexity and limited scalability. We show that, when the cost model is differentiable, the query plans can be continuously relaxed into a soft adjacency matrix representing a superposition of plans. This continuous relaxation, together with a Gumbel-Softmax parameterization of the adjacency matrix and differentiable constraints enforcing plan validity, enables gradient-based search for plans within this relaxed space. Using a learned Graph Neural Network as the cost model, we demonstrate that this gradient-based approach can find comparable and even lower-cost plans compared to traditional discrete local search methods on two different graph datasets. Furthermore, we empirically show that the runtime of this approach scales linearly with query size, in contrast to quadratic or exponential runtimes of classical approaches. We believe this first step towards gradient-based join ordering can lead to more effective and efficient query optimizers in the future.

View on arXivView PDF

Code Implementations(1)

Gradient Based Join Ordering of conjunctive SPARQL Queries

10PythonMay 9, 202511 months ago

Similar Papers

Cite this paper

@article{schwabe2025gradientbased,
  title  = {Gradient-Based Join Ordering},
  author = {Tim Schwabe and Maribel Acosta},
  year   = {2025},
  eprint = {2511.14482},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2511.14482v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2511.14482.svg)](https://codeofpaper.com/paper/2511.14482)

Discussion