Variational Autoencoder-Based Query Plan Anomaly Detection and Cost Deviation Warning for Database Systems

Main Article Content

Lu Ren
Sherly Li
Zhiyang Liu

Abstract

This paper proposes a variational autoencoder-based modeling approach for query plan anomaly detection and cost deviation warning in databases. The study first analyzes factors such as biased statistics, dynamic data distribution, and resource contention, which cause gaps between generated query plans and the true optimal execution, leading to performance fluctuation and resource waste. In the method design, an encoder maps query plans and execution features into a latent space, where the distribution is parameterized by mean and variance, and reconstruction is achieved through reparameterized sampling and a decoder to learn the latent structure of normal query plans. The objective function integrates reconstruction error, KL divergence, and a cost deviation term to jointly optimize query feature modeling and cost deviation representation. Through this mechanism, normal and abnormal plans can be effectively distinguished in the latent space, and deviations between estimated and actual costs can be sensitively captured. Furthermore, sensitivity experiments under feature missing ratios, latent dimension variations, and environmental disturbances show that the method achieves superior stability and robustness in AUC, ACC, Recall, and Precision compared with existing methods. Overall, this study provides a new technical path for query optimization and execution monitoring, enabling effective anomaly detection and early cost deviation warning in complexscenarios.

Article Details

Section

Articles