Efficient Query Rewrite Rule Discovery via Standardized Enumeration and Learning-to-Rank
Yuan Zhang, Yuxing Chen, Yuekun Yu, Jinbin Huang, Rui Mao, Anqun Pan, Lixiong Zheng, Jianbin Qin
摘要
Query rewriting is essential for database performance optimization, but existing automated rule enumeration methods suffer from exponential search spaces, severe redundancy, and poor scalability, especially when handling complex query plans with five or more nodes, where a node represents an operator in the plan tree. We present SLER, a scalable system that enables efficient and effective rewrite rule discovery by combining standardized template enumeration with a learning to rank approach. SLER uses standardized templates, abstractions of query plans with operator structures preserved but data specific details removed, to eliminate structural redundancies and drastically reduce the search space. A learn to rank model guides enumeration by pre filtering the most promising template pairs, enabling scalable rule generation for large node templates. Evaluated on over 11000 real world SQL queries from both open source and commercial workloads, SLER has automatically constructed a rewrite rule repository exceeding 1 million rules - the largest empirically validated rewrite rule library to date. Notably, at the scale of one million rules, SLER supports query plan templates with complexity up to channel level depth. This unprecedented scale opens the door to discovering highly intricate transformations across diverse query patterns. Critically, SLER's template driven design and learned ranking mechanism are inherently extensible, allowing seamless integration of new and complex operators, paving the way for next generation optimizers powered by comprehensive, adaptive rule spaces.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
脉络
- Lero: A Learning-to-Rank Query Optimizer 引用了 Deep Unsupervised Cardinality Estimation
- Lero: A Learning-to-Rank Query Optimizer 引用了 An End-to-End Learning-based Cost Estimator
- Lero: A Learning-to-Rank Query Optimizer 引用了 Reinforcement Learning with Tree-LSTM for Join Order Selection
- Lero: A Learning-to-Rank Query Optimizer 引用了 Bao: Making Learned Query Optimization Practical
- An End-to-End Learning-based Cost Estimator 引用了 Reinforcement Learning with Tree-LSTM for Join Order Selection
- Reinforcement Learning with Tree-LSTM for Join Order Selection 引用了 An End-to-End Learning-based Cost Estimator
- Bao: Making Learned Query Optimization Practical 引用了 Deep Unsupervised Cardinality Estimation
- Bao: Making Learned Query Optimization Practical 引用了 An End-to-End Learning-based Cost Estimator
它引用的 Paper15
- An End-to-End Learning-based Cost EstimatorJi Sun, Guoliang LiVLDB 2020 · 251 次引用
- Bao: Making Learned Query Optimization PracticalRyan Marcus, Parimarjan Negi, Hongzi Mao, Nesime Tatbul 等SIGMOD 2021 · 242 次引用
- Deep Unsupervised Cardinality EstimationZongheng Yang, Eric Liang, Amog Kamsetty, Chenggang Wu 等VLDB 2020 · 206 次引用
- Reinforcement Learning with Tree-LSTM for Join Order SelectionXiang Yu, Guoliang Li, Chengliang Chai, Nan TangICDE 2020 · 168 次引用
- Lero: A Learning-to-Rank Query OptimizerRong Zhu, Wei Chen, Bolin Ding, Xingguang Chen 等VLDB 2023 · 102 次引用
相关 Paper
- WeTune: Automatic Discovery and Verification of Query Rewrite RulesZhaoguo Wang, Zhou Zhou, Yicun Yang, Haoran Ding 等SIGMOD 2022 · 35 次引用
- ReSequel: Robust LLM-assisted Query Rewriting and Optimization using Templatization and SamplingSaeed Fathollahzadeh, Essam Mansour, Matthias BoehmVLDB 2026
- A Learned Query Rewrite System using Monte Carlo Tree SearchXuanhe Zhou, Guoliang Li, Chengliang Chai, Jianhua FengVLDB 2022 · 85 次引用
- GenRewrite: Query Rewriting via Large Language ModelsJie Liu, Barzan MozafariSIGMOD 2026 · 27 次引用
- LLM-R2: A Large Language Model Enhanced Rule-based Rewrite System for Boosting Query EfficiencyZhaodonghui Li, Haitao Yuan, Huiming Wang, Gao Cong 等VLDB 2025 · 52 次引用
