Lero: A Learning-to-Rank Query Optimizer
Rong Zhu, Wei Chen, Bolin Ding, Xingguang Chen, Andreas Pfadler, Ziniu Wu, Jingren Zhou
Abstract
A recent line of works apply machine learning techniques to assist or rebuild cost-based query optimizers in DBMS. While exhibiting superiority in some benchmarks, their deficiencies, e.g., unstable performance, high training cost, and slow model updating, stem from the inherent hardness of predicting the cost or latency of execution plans using machine learning models. In this paper, we introduce a learning-to-rank query optimizer, called Lero, which builds on top of a native query optimizer and continuously learns to improve the optimization performance. The key observation is that the relative order or rank of plans, rather than the exact cost or latency, is sufficient for query optimization. Lero employs a pairwise approach to train a classifier to compare any two plans and tell which one is better. Such a binary classification task is much easier than the regression task to predict the cost or latency, in terms of model efficiency and accuracy. Rather than building a learned optimizer from scratch, Lero is designed to leverage decades of wisdom of databases and improve the native query optimizer. With its non-intrusive design, Lero can be implemented on top of any existing DBMS with minimal integration efforts. We implement Lero and demonstrate its outstanding performance using PostgreSQL. In our experiments, Lero achieves near optimal performance on several benchmarks. It reduces the plan execution time of the native optimizer in PostgreSQL by up to 70% and other learned query optimizers by up to 37%. Meanwhile, Lero continuously learns and automatically adapts to query workloads and changes in data.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
38 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- λ-Tune: Harnessing Large Language Models for Automated Database System Tuning cites Bao: Making Learned Query Optimization Practical
- Sample-Efficient Cardinality Estimation Using Geometric Deep Learning cites Deep Unsupervised Cardinality Estimation
- Sample-Efficient Cardinality Estimation Using Geometric Deep Learning cites An End-to-End Learning-based Cost Estimator
- Sample-Efficient Cardinality Estimation Using Geometric Deep Learning cites Cardinality Estimation in DBMS: A Comprehensive Benchmark Evaluation
- PilotScope: Steering Databases with Machine Learning Drivers cites Eraser: Eliminating Performance Regression on Learned Query Optimizer
- PilotScope: Steering Databases with Machine Learning Drivers cites Bao: Making Learned Query Optimization Practical
- Eraser: Eliminating Performance Regression on Learned Query Optimizer cites An End-to-End Learning-based Cost Estimator
- Eraser: Eliminating Performance Regression on Learned Query Optimizer cites Cardinality Estimation in DBMS: A Comprehensive Benchmark Evaluation
- Eraser: Eliminating Performance Regression on Learned Query Optimizer cites Bao: Making Learned Query Optimization Practical
- An End-to-End Learning-based Cost Estimator cites Reinforcement Learning with Tree-LSTM for Join Order Selection
- Reinforcement Learning with Tree-LSTM for Join Order Selection cites An End-to-End Learning-based Cost Estimator
- Cardinality Estimation in DBMS: A Comprehensive Benchmark Evaluation cites An End-to-End Learning-based Cost Estimator
- Bao: Making Learned Query Optimization Practical cites Deep Unsupervised Cardinality Estimation
- Bao: Making Learned Query Optimization Practical cites An End-to-End Learning-based Cost Estimator
Cited by top-tier papers38
- λ-Tune: Harnessing Large Language Models for Automated Database System TuningVictor Giannakouris, Immanuel TrummerSIGMOD 2025 · 20 citations
- Sample-Efficient Cardinality Estimation Using Geometric Deep LearningSilvan Reiner, Michael GrossniklausVLDB 2024 · 20 citations
- Eraser: Eliminating Performance Regression on Learned Query OptimizerLianggui Weng, Rong Zhu, Di Wu, Bolin Ding et al.VLDB 2024 · 19 citations
- PilotScope: Steering Databases with Machine Learning DriversRong Zhu, Lianggui Weng, Wenqing Wei, Di Wu et al.VLDB 2024 · 18 citations
- BFTBrain: Adaptive BFT Consensus with Reinforcement LearningChenyuan Wu, Haoyun Qin, Mohammad Javad Amiri, Boon Thau Loo et al.NSDI 2025 · 17 citations
Builds on13
- An End-to-End Learning-based Cost EstimatorJi Sun, Guoliang LiVLDB 2020 · 251 citations
- Bao: Making Learned Query Optimization PracticalRyan Marcus, Parimarjan Negi, Hongzi Mao, Nesime Tatbul et al.SIGMOD 2021 · 242 citations
- Deep Unsupervised Cardinality EstimationZongheng Yang, Eric Liang, Amog Kamsetty, Chenggang Wu et al.VLDB 2020 · 206 citations
- Cardinality Estimation in DBMS: A Comprehensive Benchmark EvaluationYuxing Han, Ziniu Wu, Peizhi Wu, Rong Zhu et al.VLDB 2022 · 169 citations
- Reinforcement Learning with Tree-LSTM for Join Order SelectionXiang Yu, Guoliang Li, Chengliang Chai, Nan TangICDE 2020 · 168 citations
Related papers
- RankPQO: Learning-to-Rank for Parametric Query OptimizationSongsong Mo, Yue Zhao, Zhifeng Bao, Quanqing Xu et al.VLDB 2025 · 3 citations
- Athena: An Effective Learning-based Framework for Query Optimizer Performance ImprovementRunzhong Li, Qilong Li, Haotian Liu, Rui Mao et al.SIGMOD 2025 · 3 citations
- Practical Parameterized Query Optimization via Efficient Plan Reuse and List-wise RankingHai Lan, Yang Yu, Zhifeng Bao, Zi Huang et al.SIGMOD 2026
- How Good are Learned Cost Models, Really? Insights from Query Optimization TasksRoman Heinrich, Manisha Luthra, Johannes Wehrstein, Harald Kornmayer et al.SIGMOD 2025 · 13 citations
- Cost-based or Learning-based? A Hybrid Query Optimizer for Query Plan SelectionXiang Yu, Chengliang Chai, Guoliang Li, Jiabin LiuVLDB 2022 · 82 citations
