WeTune: Automatic Discovery and Verification of Query Rewrite Rules
Zhaoguo Wang, Zhou Zhou, Yicun Yang, Haoran Ding, Gansen Hu, Ding Ding, Chuzhe Tang, Haibo Chen, Jinyang Li
摘要
Query rewriting transforms a relational database query into an equivalent but more efficient one, which is crucial for the performance of database-backed applications. Such rewriting relies on pre-specified rewrite rules. In existing systems, these rewrite rules are discovered through manual insights and accumulate slowly over the years.
In this paper, we present WeTune, a rule generator that automatically discovers new rewrite rules. Inspired by compiler superoptimization, WeTune enumerates all valid logical query plans up to a certain size and tries to discover equivalent plans that could potentially lead to more efficient rewrites. The core challenge is to determine which set of conditions (aka constraints) allows one to prove the equivalence between a pair of query plans. We address this challenge by enumerating combinations of "interesting" constraints that relate tables and their attributes between each pair of queries. We also propose a new SMT-based verifier to verify the equivalence of a query pair under different enumerated constraints. To evaluate the usefulness of rewrite rules discovered by WeTune, we apply them on the SQL queries collected from the 20 most popular open-source web applications on GitHub. WeTune successfully optimizes 247 queries that existing databases cannot optimize, resulting in substantial performance improvements.
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了最后一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
引用它的顶会 Paper24
- 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 次
- D-Bot: Database Diagnosis System using Large Language ModelsXuanhe Zhou, Guoliang Li, Zhaoyan Sun, Zhiyuan Liu 等VLDB 2024 · 被引用 50 次
- GenRewrite: Query Rewriting via Large Language ModelsJie Liu, Barzan MozafariSIGMOD 2026 · 被引用 27 次
- Proving Query Equivalence Using Linear Integer ArithmeticHaoran Ding, Zhaoguo Wang, Yicun Yang, Dexin Zhang 等SIGMOD 2024 · 被引用 20 次
- A Unified and Efficient Coordinating Framework for Autonomous DBMS TuningXinyi Zhang, Zhuo Chang, Hong Wu, Yang Li 等SIGMOD 2023 · 被引用 17 次
它引用的顶会 Paper3
- A Learned Query Rewrite System using Monte Carlo Tree SearchXuanhe Zhou, Guoliang Li, Chengliang Chai, Jianhua FengVLDB 2022 · 被引用 85 次
- Rewrite rule inference using equality saturationChandrakana Nandi, Max Willsey, Amy Zhu, Yisu Remy Wang 等OOPSLA 2021 · 被引用 35 次
- SQLCheck: Automated Detection and Diagnosis of SQL Anti-PatternsPrashanth Dintyala, Arpit Narechania, Joy ArulrajSIGMOD 2020 · 被引用 26 次
相关 Paper
- ARG: Testing Query Rewriters via Abstract Rule Guided FuzzingDawei Li, Yuxiao Guo, Qifan Liu, Jie Liang 等ASE 2025
- Efficient Query Rewrite Rule Discovery via Standardized Enumeration and Learning-to-RankYuan Zhang, Yuxing Chen, Yuekun Yu, Jinbin Huang 等ICDE 2026
- QueryBooster: Improving SQL Performance Using Middleware Services for Human-Centered Query RewritingQiushi Bai, Sadeem Alsudais, Chen LiVLDB 2023 · 被引用 14 次
- ReSequel: Robust LLM-assisted Query Rewriting and Optimization using Templatization and SamplingSaeed Fathollahzadeh, Essam Mansour, Matthias BoehmVLDB 2026
- Leveraging Application Data Constraints to Optimize Database-Backed Web ApplicationsXiaoxuan Liu, Shuxian Wang, Mengzhu Sun, Sicheng Pan 等VLDB 2023 · 被引用 13 次
