SlabCity: Whole-Query Optimization using Program Synthesis
Rui Dong, Jie Liu, Yuxuan Zhu, Cong Yan, Barzan Mozafari, Xinyu Wang
Abstract
Query rewriting is often a prerequisite for effective query optimization, particularly for poorly-written queries. Prior work on query rewriting has relied on a set of "rules" based on syntactic pattern-matching. Whether relying on manual rules or auto-generated ones, rule-based query rewriters are inherently limited in their ability to handle new query patterns. Their success is limited by the quality and quantity of the rules provided to them.
To our knowledge, we present the first synthesis-based query rewriting technique, SlabCity, capable of whole-query optimization without relying on any rewrite rules. SlabCity directly searches the space of SQL queries using a novel query synthesis algorithm that leverages a new concept called query dataflows. We evaluate SlabCity on four workloads, including a newly curated benchmark with more than 1000 real-life queries. We show that not only can SlabCity optimize more queries than state-of-the-art query rewriting techniques, but interestingly, it also leads to queries that are significantly faster than those generated by rule-based systems.
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.
4 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
- Geo: A Query Rewrite Framework for Graph Pattern Mining cites A Learned Query Rewrite System using Monte Carlo Tree Search
- Geo: A Query Rewrite Framework for Graph Pattern Mining cites WeTune: Automatic Discovery and Verification of Query Rewrite Rules
- GenRewrite: Query Rewriting via Large Language Models cites A Learned Query Rewrite System using Monte Carlo Tree Search
- GenRewrite: Query Rewriting via Large Language Models cites WeTune: Automatic Discovery and Verification of Query Rewrite Rules
- Learned Offline Query Planning via Bayesian Optimization cites Balsa: Learning a Query Optimizer Without Expert Demonstrations
- Learned Offline Query Planning via Bayesian Optimization cites A Learned Query Rewrite System using Monte Carlo Tree Search
- WeTune: Automatic Discovery and Verification of Query Rewrite Rules cites A Learned Query Rewrite System using Monte Carlo Tree Search
- WeTune: Automatic Discovery and Verification of Query Rewrite Rules cites SQLCheck: Automated Detection and Diagnosis of SQL Anti-Patterns
- ReSequel: Robust LLM-assisted Query Rewriting and Optimization using Templatization and Sampling cites GenRewrite: Query Rewriting via Large Language Models
- ReSequel: Robust LLM-assisted Query Rewriting and Optimization using Templatization and Sampling cites A Learned Query Rewrite System using Monte Carlo Tree Search
- ReSequel: Robust LLM-assisted Query Rewriting and Optimization using Templatization and Sampling cites WeTune: Automatic Discovery and Verification of Query Rewrite Rules
Cited by top-tier papers4
- GenRewrite: Query Rewriting via Large Language ModelsJie Liu, Barzan MozafariSIGMOD 2026 · 27 citations
- Learned Offline Query Planning via Bayesian OptimizationJeffrey Tao, Natalie Maus, Haydn Thomas Jones, Yimeng Zeng et al.SIGMOD 2025 · 5 citations
- Geo: A Query Rewrite Framework for Graph Pattern MiningNazanin Yousefian, Kasra Jamshidi, Keval Vora, Anders MiltnerOOPSLA 2026
- ReSequel: Robust LLM-assisted Query Rewriting and Optimization using Templatization and SamplingSaeed Fathollahzadeh, Essam Mansour, Matthias BoehmVLDB 2026
Builds on9
- Balsa: Learning a Query Optimizer Without Expert DemonstrationsZongheng Yang, Wei-Lin Chiang, Sifei Luan, Gautam Mittal et al.SIGMOD 2022 · 99 citations
- A Learned Query Rewrite System using Monte Carlo Tree SearchXuanhe Zhou, Guoliang Li, Chengliang Chai, Jianhua FengVLDB 2022 · 85 citations
- Provenance-guided synthesis of Datalog programsMukund Raghothaman, Jonathan Mendelson, David Zhao, Mayur Naik et al.POPL 2020 · 49 citations
- WeTune: Automatic Discovery and Verification of Query Rewrite RulesZhaoguo Wang, Zhou Zhou, Yicun Yang, Haoran Ding et al.SIGMOD 2022 · 35 citations
- SQLCheck: Automated Detection and Diagnosis of SQL Anti-PatternsPrashanth Dintyala, Arpit Narechania, Joy ArulrajSIGMOD 2020 · 26 citations
Related papers
- QueryBooster: Improving SQL Performance Using Middleware Services for Human-Centered Query RewritingQiushi Bai, Sadeem Alsudais, Chen LiVLDB 2023 · 14 citations
- TACO: A Benchmark for Open-Domain Text-to-SQL with Ambiguous and Cross-Database QueriesChao Deng, Ju Fan, Yuyu Luo, Qinliang Xue et al.VLDB 2026 · 1 citation
- ARG: Testing Query Rewriters via Abstract Rule Guided FuzzingDawei Li, Yuxiao Guo, Qifan Liu, Jie Liang et al.ASE 2025
- Efficient Query Rewrite Rule Discovery via Standardized Enumeration and Learning-to-RankYuan Zhang, Yuxing Chen, Yuekun Yu, Jinbin Huang et al.ICDE 2026
- Synthesizing Document Database Queries Using Collection AbstractionsQikang Liu, Yang He, Yanwen Cai, Byeongguk Kwak et al.ICSE 2025
