Bao: Making Learned Query Optimization Practical
Ryan Marcus, Parimarjan Negi, Hongzi Mao, Nesime Tatbul, Mohammad Alizadeh, Tim Kraska
Abstract
Query optimization remains one of the most challenging problems in data management systems. Recent efforts to apply machine learning techniques to query optimization challenges have been promising, but have shown few practical gains due to substantive training overhead, inability to adapt to changes, and poor tail performance. Motivated by these difficulties and drawing upon a long history of research in multi-armed bandits, we introduce Bao (the Bandit optimizer). Bao takes advantage of the wisdom built into existing query optimizers by providing per-query optimization hints. Bao combines modern tree convolutional neural networks with Thompson sampling, a decades-old and well-studied reinforcement learning algorithm. As a result, Bao automatically learns from its mistakes and adapts to changes in query workloads, data, and schema. Experimentally, we demonstrate that Bao can quickly (an order of magnitude faster than previous approaches) learn strategies that improve end-to-end query execution performance, including tail latency. In cloud environments, we show that Bao can offer both reduced costs and better performance compared with a sophisticated commercial system.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext f3f041d0-74c5-4ce0-a2e1-f7534ec73ed2Cited by top-tier papers95
- QueryFormer: A Tree Transformer Model for Query Plan RepresentationYue Zhao, Gao Cong, Jiachen Shi, Chunyan MiaoVLDB 2022 · 117 citations
- Lero: A Learning-to-Rank Query OptimizerRong Zhu, Wei Chen, Bolin Ding, Xingguang Chen et al.VLDB 2023 · 102 citations
- Balsa: Learning a Query Optimizer Without Expert DemonstrationsZongheng Yang, Wei-Lin Chiang, Sifei Luan, Gautam Mittal et al.SIGMOD 2022 · 99 citations
- Zero-Shot Cost Models for Out-of-the-box Learned Cost PredictionBenjamin Hilprecht, Carsten BinnigVLDB 2022 · 90 citations
- Robust Query Driven Cardinality Estimation under Changing WorkloadsParimarjan Negi, Ziniu Wu, Andreas Kipf, Nesime Tatbul et al.VLDB 2023 · 88 citations
Builds on3
- An End-to-End Learning-based Cost EstimatorJi Sun, Guoliang LiVLDB 2020 · 251 citations
- Deep Unsupervised Cardinality EstimationZongheng Yang, Eric Liang, Amog Kamsetty, Chenggang Wu et al.VLDB 2020 · 206 citations
- QuickSel: Quick Selectivity Learning with Mixture ModelsYongjoo Park, Shucheng Zhong, Barzan MozafariSIGMOD 2020 · 66 citations
Related papers
- Bayesian Optimization for Categorical and Category-Specific Continuous InputsDang Nguyen, Sunil Gupta, Santu Rana, Alistair Shilton et al.AAAI 2020 · 59 citations
- FOSS: A Self-Learned Doctor for Query OptimizerKai Zhong, Luming Sun, Tao Ji, Cuiping Li et al.ICDE 2024 · 5 citations
- Low Rank Learning for Offline Query OptimizationZixuan Yi, Yao Tian, Zachary G. Ives, Ryan MarcusSIGMOD 2025 · 4 citations
- LIMAO: A Framework for Lifelong Modular Learned Query OptimizationQihan Zhang, Shaolin Xie, Ibrahim SabekVLDB 2025 · 4 citations
- Reqo: A Comprehensive Learning-Based Cost Model for Robust and Explainable Query OptimizationBaoming Chang, Amin Kamali, Verena KantereSIGMOD 2026 · 1 citation
