Enhancing SQL Query Performance via XAI: A Dual SHAP–LIME Framework for Accurate Response Time Prediction and Optimization in RDBMS
Abstract
Optimization of queries in RDBMSs have been one of the most important roadblocks as the rule-based optimizer s fail to scale to the non-linear nature of the new analytical workloads. Although Machine Learning (ML) models have demonstrated good latency predictability, their poor interpret-ability creates a Trust Gap that restricts their use. This paper introduces XAIExplainer, a dual-explanation framework that combines a three-model ensemble predictor (Lasso Regression, Extremely Randomized Trees, and a Keras-based plan-structured residual network) with SHAP and LIME along with the Spearman rank-correlation protocol is used. When measured on three real-world Oracle SQL queries, with varying levels of complexity, XAIExplainer achieved a significant latency speedup of 35, 72, and 31 with high predictive accuracy (R 2 = 0.9712, MAE = 18.4 ms) and a 91.2% SHAPLIME agreement rate. XAIExplainer successfully addresses the interpretability gap by converting the quantitative attributions into the form of the DBA-understandable narratives, SQL rewrite strategies, and automatic index suggestions.