Main Article Content

Authors

Hanan Abed Alwally Abed Allah

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.

Share This Article On Social Media
Usage Statistics

Downloads

Download data is not yet available.

Article Details

Section
Research