Reinforcement Learning with Tree-LSTM for Join Order Selection
Xiang Yu, Guoliang Li, Chengliang Chai, Nan Tang
摘要
Join order selection (JOS) -the problem of finding the optimal join order for an SQL query -is a primary focus of database query optimizers. The problem is hard due to its large solution space. Exhaustively traversing the solution space is prohibitively expensive, which is often combined with heuristic pruning. Despite decades-long effort, traditional optimizers still suffer from low scalability or low accuracy when handling complicated SQL queries. Recent attempts using deep reinforcement learning (DRL), by encoding join trees with fixed-length handtuned feature vectors, have shed some light on JOS. However, using fixed-length feature vectors cannot capture the structural information of a join tree, which may produce poor join plans. Moreover, it may also cause retraining the neural network when handling schema changes (e.g., adding tables/columns) or multialias table names that are common in SQL queries.
In this paper, we present RTOS, a novel learned optimizer that uses Reinforcement learning with Tree-structured long shortterm memory (LSTM) for join Order Selection. RTOS improves existing DRL-based approaches in two main aspects: (1) it adopts graph neural networks to capture the structures of join trees; and (2) it well supports the modification of database schema and multi-alias table names. Extensive experiments on Join Order Benchmark (JOB) and TPC-H show that RTOS outperforms traditional optimizers and existing DRL-based learned optimizers. In particular, the plan RTOS generated for JOB is 101% on (estimated) cost and 67% on latency (i.e., execution time) on average, compared with dynamic programming that is known to produce the state-of-the-art results on join plans.
Example 1 shows that, join trees with different join orders may be encoded into the same feature vector using existing learners; that is, they only consider the static information (such as tables and columns) of a join, without being able to capture the structural information of a join tree. Intuitively, a better learner should also understand different structural information of different join trees.
Our Methodology. Based on the above observation, we present RTOS, a novel learned optimizer using tree-structured long short-term memory (Tree-LSTM) [37]. RTOS trains a DRL model for JOS, which can automatically improve future JOS by learning from previously executed queries.
Tree-LSTM is one kind of graph neural networks (GNNs).
1297
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了每一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
引用它的顶会 Paper54
- An End-to-End Learning-based Cost EstimatorJi Sun, Guoliang LiVLDB 2020 · 被引用 251 次
- Are We Ready For Learned Cardinality Estimation?Xiaoying Wang, Changbo Qu, Weiyuan Wu, Jiannan Wang 等VLDB 2021 · 被引用 156 次
- QueryFormer: A Tree Transformer Model for Query Plan RepresentationYue Zhao, Gao Cong, Jiachen Shi, Chunyan MiaoVLDB 2022 · 被引用 117 次
- Lero: A Learning-to-Rank Query OptimizerRong Zhu, Wei Chen, Bolin Ding, Xingguang Chen 等VLDB 2023 · 被引用 102 次
- Learned Cardinality Estimation: A Design Space Exploration and A Comparative EvaluationJi Sun, Jintao Zhang, Zhaoyan Sun, Guoliang Li 等VLDB 2022 · 被引用 90 次
它引用的顶会 Paper1
相关 Paper
- LOGER: A Learned Optimizer towards Generating Efficient and Robust Query Execution PlansTianyi Chen, Jun Gao, Hedui Chen, Yaofeng TuVLDB 2023 · 被引用 54 次
- Efficient Join Order Selection Learning with Graph-based RepresentationJin Chen, Guanyu Ye, Yan Zhao, Shuncheng Liu 等KDD 2022 · 被引用 27 次
- FOSS: A Self-Learned Doctor for Query OptimizerKai Zhong, Luming Sun, Tao Ji, Cuiping Li 等ICDE 2024 · 被引用 5 次
- GLO: Towards Generalized Learned Query OptimizationTianyi Chen, Jun Gao, Yaofeng Tu, Mo XuICDE 2024 · 被引用 7 次
- Balsa: Learning a Query Optimizer Without Expert DemonstrationsZongheng Yang, Wei-Lin Chiang, Sifei Luan, Gautam Mittal 等SIGMOD 2022 · 被引用 99 次
