Skip to content
Open access

LLM-augmented query optimization: a hybrid framework for intelligent SQL performance tuning

2026 · BOHR International Journal of Internet of things, Artificial Intelligence and Machine Learning · 0 citations

TL;DR

LLM-QOpt++ is presented, a novel hybrid, confidence-aware query optimization framework that unifies traditional CBO estimation, machine learning–based cost prediction, and large language model (LLM) reasoning within a single adaptive pipeline.

Abstract

Query optimization remains a critical challenge in relational database management systems (RDBMSs). Traditional Cost-Based Optimization (CBOs) depend on static cardinality estimation and rigid heuristics that break down under skewed data distributions, complex join structures, and heterogeneous workloads. While learned query optimization methods offer improved cost estimation, they remain vulnerable to schema drift and unseen query templates and lack the interpretability required by database administrators. This paper presents LLM-QOpt++, a novel hybrid, confidence-aware query optimization framework that unifies traditional CBO estimation, machine learning–based cost prediction, and large language model (LLM) reasoning within a single adaptive pipeline. Key components include operator-level cost decomposition; an LLM-based query reasoning advisor that detects structured query language (SQL) anti-patterns and generates context-aware rewrite suggestions; a confidenceaware decision mechanism for adaptive strategy selection; a failed-plan learning memory (FPLM) that suppresses historically inefficient execution plans; and an explainability-guided layer leveraging SHapley Additive exPlanations (SHAP) attribution, attention analysis, and natural language reasoning. A dynamic hybrid fusion mechanism blends CBO, ML, and LLM signals according to per-query confidence estimates. Evaluated on TPC-H (SF100) and TPCDS (SF300), LLM-QOpt++ achieves a 38.4% reduction in mean absolute cost estimation error over the best learned baseline (95% CI: [35.1%, 41.9%]; p < 0.001), a 2.37_ geometric mean speedup over PostgreSQL’s native optimizer (95% CI: [2.21_, 2.53_]; p < 0.001), and an F1-score of 0.89 in strategy classification. By integrating statistical, learned, and LLM-based reasoning under a confidence-aware architecture, LLM-QOpt++ delivers query optimization that is simultaneously more accurate and more interpretable than existing baselines.

Read PDF

Similar papers

Open access Aug 2026

An Adaptive Physical Design Optimization Framework for SQL-Based Systems Using Incremental Workload Analysis and Cost-Driven Configuration Search

This paper presents a structured algorithmic framework for automated physical design tuning in SQL-based relational databases that intelligently parses SQL workloads, identifies syntactically relevant and workload-significant table subsets and column groups, and iteratively refines candidate physical design structures...

Sheshukumar Vangala · 1 citation

SEFRQO-Plus: A Self-Evolving Query Optimizer via Large Language Models and Retrieval-Augmented Generation

This paper designs a feedback-oriented vector database with query structure-aware embed-dings to support effective similarity search, and incorporates multi-layered histories as references to enrich the feedback, and enhances the prompt optimization work-flow by utilizing multi-dimensional historical feedback to drive...

Han-Wen Liu, Qihan Zhang, Ryan Marcus et al. · 0 citations
Book Open access Aug 2026

DBRepro: Automated Database Synthesis via a Hybrid Constraint-Solving Approach for Reproducing Slow Queries

DBRepro is presented, an automated end-to-end framework that formulates database generation as a constrained distribution synthesis problem that reproduces the execution performance of complex slow queries with high fidelity on a nearly 1 TB real-world dataset.

Zhao-Yang Zhang, Shuang Liu, Deng-Feng Xu et al. · 0 citations
Open access May 2026

SafeQL: Search-based Refinement for Safe and Efficient LLM-based Text-to-SQL

SafeQL is proposed, a search-based refinement paradigm that redefines the role of the DBMS as an active guide in the refinement process, and significantly improves execution accuracy and efficiency compared to regeneration-based methods.

Geonho Lee, Min-Soo Kim · 0 citations
Aug 2026

QueryBrew: System-Agnostic SQL-to-SQL Query Optimization

QueryBrew is presented, a system-agnostic query optimization service that decouples the optimizer from the database engine through SQL-to-SQL rewriting, and distills the optimized execution plan back into an operator-oriented SQL representation.

Tobias Schmidt, Maximilian Reif, Altan Birler et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.