SEFRQO-Plus: a self-evolving query optimizer via large language models and retrieval-augmented generation
Hanwen Liu, Qihan Zhang, Ryan Marcus, Ibrahim Sabek
Key points
From the paper's conclusion- We initially proposed SEFRQO, a Self-Evolving Fine-tuned RAG-based Query Optimizer, which leverages fine-tuned LLMs to address these challenges and uses in-context learning to achieve continuous evolution.
Abstract
Query optimization is a crucial problem in database systems that has been studied for decades. Learned query optimizers (LQOs) can improve performance over time by incorporating feedback; however, they suffer from cold-start issues and often require retraining when workloads shift or schemas change. We initially proposed SEFRQO, a Self-Evolving Fine-tuned RAG-based Query Optimizer, which leverages fine-tuned LLMs to address these challenges and uses in-context learning to achieve continuous evolution. However, its system design relies on the assumption of repetitive query workloads, requires executing queries statically upon their first encounter (incurring extra overhead), and utilizes only partial feedback from the best historical records (insufficient feedback design). In this paper, we present SEFRQO-Plus, which resolves the above limitations. First, we design a feedback-oriented vector database with query structure-aware embeddings to support effective similarity search, and we incorporate multi-layered histories as references to enrich the feedback. Then, we enhance the prompt optimization workflow by utilizing multi-dimensional historical feedback to drive continuous self-evolution. Moreover, we provide formal theoretical proofs to validate the advantages of our customized query group relative policy optimization. Evaluations show that SEFRQO-Plus outperforms state-of-the-art LQOs, achieving reductions of 66.52% and 69.79% in query latency for the complete CEB and Stack workloads, respectively, compared to PostgreSQL. SEFRQO-Plus achieves an additional 15% improvement over the initial SEFRQO. Moreover, it generalizes effectively across multiple workloads and scenarios, and even across different DBMSes.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- GenRewrite: Query Rewriting via Large Language ModelsProceedings of the ACM on Management of Data · 2026
- DBRAG: Multi-Table Retrieval-Augmented Generation for Complex Database QueriesarXiv · 2026
- Schema Retrieval with Embeddings and Vector Stores Using Retrieval-Augmented Generation and LLM-Based SQL Query GenerationApplied Sciences · 2026
- Optimizing Query Decomposition for Reliable ValidationarXiv · 2026
- Reimagining Text-to-SQL: A Survey of Large Language Model Architectures and StrategiesarXiv · 2026
- SchemaRAG: A Schema-aware Retrieval-Augmented Generation Framework for Text-to-SQLProceedings of the ACM on Management of Data · 2026