SEFRQO-Plus: a self-evolving query optimizer via large language models and retrieval-augmented generation
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.
Authors
- Ryan Marcus (ORCID: https://orcid.org/0000-0002-1279-1124)
- Ibrahim Sabek (ORCID: https://orcid.org/0009-0006-2102-5241)
- Hanwen Liu (ORCID: https://orcid.org/0000-0002-5265-9312)
- Q. Zhang (ORCID: https://orcid.org/0009-0005-5785-8766)
Institutions
- University of Southern California (US)
- University of Pennsylvania (US)
Publication Details
- Journal
- The VLDB Journal
- Published
- 2026-10-15
- DOI
- https://doi.org/10.1007/s00778-026-00999-z
- Primary Topic
- Advanced Database Systems and Queries
- Type
- article
- Field-Weighted Citation Impact
- 0.00