A Novel Framework Using Deep Reinforcement Learning for Join Order Selection
Chang Liu, Amin Kamali, Verena Kantere, Calisto Zuzarte, Vincent Corvinelli
TL;DR
Join order optimization faces an exponential search space, limiting traditional optimizers. The authors introduce GTDD, a framework that fuses Graph Neural Networks, Tree-LSTM, and a dueling-DQN reinforcement learner with curriculum learning to learn adaptive join orders, supported by rich multi-level representations. They propose a novel ratio-based reward and an action-masking mechanism to stabilize training and accelerate convergence. Evaluations on JOB and TPC-H show GTDD outperforms state-of-the-art DRL-based methods and closely approaches or matches dynamic programming baselines, with faster convergence and greater generalization, suggesting practical impact for scalable learned optimizers in DBMS query planning.
Abstract
Join order selection is a sub-field of query optimization that aims to find the optimal join order for an SQL query with the minimum cost. The challenge lies in the exponentially growing search space as the number of tables increases, making exhaustive enumeration impractical. Traditional optimizers use static heuristics to prune the search space, but they often fail to adapt to changes or improve based on feedback from the DBMS. Recent research addresses these limitations with Deep Reinforcement Learning (DRL), allowing models to use feedback to dynamically search for better join orders and enhance performance over time. Existing research primarily focuses on capturing join order sequences and their representations at various levels, with limited comparative analysis of reinforcement learning methods. In this paper, we propose GTDD, a novel framework that integrates Graph Neural Networks (GNN), Treestructured Long Short-Term Memory (Tree LSTM), and DuelingDQN. We conduct a series of experiments that demonstrate a clear advantage of GTDD over state-of the-art techniques.
