Score
Designing and implementing strategies to rewrite, plan, index, and execute queries efficiently—covering trainable query plans, compact compliance-aware metadata encodings, and composable index-backed operators for ingest-once/query-many workloads.
This work addresses heterogeneous optimization decisions—view materialization, index selection, and execution plan caching—in multi-query database optimization. We propose the first unified cross-scenario modeling framework, formally establishing its NP-hardness and identifying the fundamental sources of computational complexity. Methodologically, we integrate combinatorial optimization, dynamic programming, and greedy heuristics, and introduce, for the first time, an end-to-end learning model to systematically incorporate machine learning into query optimization. Our algorithm achieves provably exponential speedup in theory. Extensive experiments demonstrate that the proposed approach significantly outperforms state-of-the-art techniques across multiple benchmarks. Furthermore, we establish a comprehensive taxonomy encompassing both classical and learning-based algorithms, and delineate key open challenges and promising directions for future research.
Traditional database systems rely on static rewrite rules that struggle to adapt to diverse queries and system characteristics, while existing large language model (LLM)-based approaches suffer from an excessively large search space, unreliable validation, and insufficient use of metadata. This work proposes a plug-in optimization layer that integrates catalog and statistical metadata to generate templated rules guiding LLM-based SQL rewriting. Semantic correctness is verified using sampled data, and candidate plans are ranked to enhance performance. The method is compatible with PostgreSQL, MySQL, and DuckDB, achieving up to 16× speedup over native DBMS optimizers and 22× over current LLM-based methods across eight benchmarks, with individual queries accelerated by over 600×—significantly surpassing the limitations of both traditional rule-based and pure LLM-driven approaches.
SQL query rewriting faces a fundamental trade-off between performance optimization and interpretability, while remaining prone to semantic or syntactic errors. Method: This paper proposes an LLM-driven, database-aware rewriting framework featuring a novel token-probability-guided rewrite path selection mechanism; it integrates metadata-aware prompting, selectivity-aware rewriting rules, redundancy elimination, and dual verification—logical equivalence checking and statistical consistency validation. Contribution/Results: The framework bridges the gap between purely rule-based and purely LLM-based approaches, enabling robust end-to-end rewriting. Experiments on TPC-DS show that two-thirds of queries achieve >1.5× speedup; rewrite coverage reaches four times that of the state-of-the-art; and the geometric mean speedup improves by an order of magnitude. The framework has been integrated into the LITHE system and validated across mainstream database platforms.
Existing SQL rewriting approaches struggle to substantially improve the performance of modern analytical queries while preserving semantic correctness. This work formulates SQL rewriting as a policy optimization problem and introduces a GRPO-based reinforcement learning framework that integrates multi-dimensional reward signals, including semantic equivalence, textual similarity, physical plan divergence, and runtime speedup. The approach innovatively incorporates a probabilistic gating mechanism for adaptive reward shaping and a curriculum learning–driven hierarchical reward unlocking strategy, complemented by an intra-policy self-improvement mechanism to enhance both sample efficiency and rewrite quality. Experimental results demonstrate that the proposed method significantly outperforms rule-based and large language model (LLM) baselines on both in-distribution and out-of-distribution workloads, markedly reducing performance-degrading rewrites and effectively mitigating tail latency.
This work addresses the limitations of existing SQL rewriting approaches, which either rely on rigid rule-based systems lacking adaptability or depend on large language models (LLMs) that incur high computational costs and privacy concerns. To overcome the scarcity of high-quality domain-specific data for training small language models, the authors propose LASER, a novel framework that integrates Monte Carlo Tree Search (MCTS) with LLM-guided mutation to generate SQL-MCTS—a large-scale corpus of complex, slow queries. They further introduce SQL-GRPO, a group-relative policy optimization algorithm featuring anchored group advantages and a complexity-adaptive dynamic rollout mechanism. Experiments on the Qwen3 small model demonstrate that LASER achieves an exceptional trade-off among execution efficiency, zero-shot transfer capability, and inference overhead, significantly outperforming both rule-based systems and LLM-based alternatives.
Existing SQL query rewriting approaches rely on predefined rules, encountering three key bottlenecks: difficulty in discovering effective rules, poor generalizability, and inability to express complex optimization logic—leading to narrow coverage and frequent performance regressions. This paper proposes the first training-free, feedback-aware LLM-based multi-agent framework for dynamic query rewriting. It integrates a finite-state-machine-driven workflow controller, a database execution feedback loop, a rewriting middleware layer, and prompt injection techniques to ensure both semantic equivalence and high-performance execution. Experimental results demonstrate that, compared to state-of-the-art methods, our approach achieves up to a 35.8% reduction in query execution time and a 24.1% improvement in rewriting success rate. Moreover, it significantly broadens support for complex query patterns and diverse rewriting strategies.
Traditional query optimizers rely on handcrafted heuristics and statistical models, which struggle to capture the semantic relationships between queries and schemas, thereby limiting the effectiveness of physical execution plan optimization. This work proposes a novel approach that serializes execution plans into compact representations and leverages the semantic understanding capabilities of large language models (LLMs) to generate localized editing suggestions. These suggestions are integrated within an evolutionary search framework to iteratively refine candidate plans. By uniquely combining LLMs with evolutionary sampling, the method enables automatic, implicit optimization of execution plans, transcending the constraints of conventional cost models. Experiments on the DBPlanBench framework with the DataFusion engine demonstrate up to a 4.78× speedup on certain queries, and show that optimization strategies discovered in small-scale settings effectively transfer to large-scale databases.
This work addresses the limitation of existing research, which often focuses narrowly on a single stage of materialized view acceleration, lacking holistic evaluation of the end-to-end pipeline encompassing candidate generation, view selection, and query rewriting. The paper introduces the first comprehensive benchmarking framework that systematically assesses the interplay among these three stages under storage constraints through modular design and controlled ablation studies. It further incorporates a cross-engine protocol to compare native optimizer-level rewriting against portable SQL-based rewriting baselines. The study reveals strong interdependencies among pipeline stages, significant performance disparities across systems, and identifies representative failure patterns that lead to performance degradation after rewriting.
This work addresses the poor performance of large language models (LLMs) on complex, multi-step, and data-dependent Text-to-SQL tasks by proposing a training-free inference framework. The approach employs a lightweight schema selector to prune the database schema and a complexity-aware routing mechanism based on an LLM judge: simple queries are directly translated into SQL, while complex ones are decomposed into atomic subproblems structured as a directed acyclic graph (DAG). These subproblems are then resolved through retrieval-augmented generation (RAG) and topologically optimized for plan-level refinement. Evaluated on the BIRD and Spider benchmarks, the framework achieves execution accuracies of 70.53% and 88.31%, respectively—substantially outperforming existing training-free methods—while reducing inference token consumption by an order of magnitude. Moreover, it functions as a plug-and-play module that enhances the performance of existing SQL generation models.
Traditional query rewriting rules are tightly coupled with execution engines and lack formal correctness guarantees, making them difficult to port and error-prone. This work proposes Rulescript, an engine-agnostic domain-specific language that decouples rule specification from execution through a match-and-transform two-phase mechanism and automatically verifies semantic equivalence using a relational algebra core. Rulescript supports custom operators and, combined with lightweight adapters, enables cross-engine deployment. The authors experimentally reproduce 33 Apache Calcite rewrite rules and successfully migrate them to both CockroachDB and Apache DataFusion, demonstrating the feasibility of “write once, deploy anywhere.” To the best of our knowledge, this is the first extensible, verifiable, and cross-platform query rewriting framework.
This work addresses the challenges of automated query rewrite rule discovery—namely, combinatorial explosion in the search space, structural redundancy, and limited scalability to complex queries involving more than five nodes. The authors propose a synergistic framework that integrates normalized query templates with Learning-to-Rank (LTR). By abstracting operator structures and stripping away data-specific details, the approach eliminates redundant candidates, while an LTR model pre-screens high-potential template pairs to dramatically improve enumeration efficiency. This method enables, for the first time, the construction of a million-scale empirically validated rewrite rule repository, automatically generating over one million rules from more than 11,000 real-world SQL queries. It scales to deeply nested, channel-level complex query templates and achieves high coverage, efficiency, and strong extensibility across diverse operators.