QUITE: A Query Rewrite System Beyond Rules with LLM Agents
Yuyang Song, Hanxu Yan, Jiale Lao, Yibo Wang, Yufei Li, Yuanchun Zhou, Jianguo Wang, Mingjie Tang

TL;DR
QUITE leverages multi-agent LLM systems with feedback mechanisms to perform semantic-preserving SQL query rewrites that outperform rule-based methods in efficiency and coverage.
Contribution
This paper introduces QUITE, a training-free, feedback-aware LLM agent system for SQL query rewriting that surpasses rule-based approaches in performance and scope.
Findings
Reduces query execution time by up to 35.8%.
Generates 24.1% more rewrites than prior methods.
Handles a broader range of query patterns.
Abstract
Query rewrite transforms SQL queries into semantically equivalent forms that run more efficiently. Existing approaches mainly rely on predefined rewrite rules, but they handle a limited subset of queries and can cause performance regressions. This limitation stems from three challenges of rule-based query rewrite: (1) it is hard to discover and verify new rules, (2) fixed rewrite rules do not generalize to new query patterns, and (3) some rewrite techniques cannot be expressed as fixed rules. Motivated by the fact that human experts exhibit significantly better rewrite ability but suffer from scalability, and Large Language Models (LLMs) have demonstrated nearly human-level semantic and reasoning abilities, we propose a new approach of using LLMs to rewrite SQL queries beyond rules. Due to the hallucination problems in LLMs, directly applying LLMs often leads to nonequivalent and…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Database Systems and Queries · Semantic Web and Ontologies · Web Data Mining and Analysis
