Implementation of the Isolation Forest Algorithm for Mysql Query Performance Anomaly Detection Based on Data Performance Schema - Tengku, Tengku Didi Ferdillah; Relita Buaton; Siswan Syahputra, (Journal of Artificial Intelligence and Engineering Applications (JAIEA), 2025)
Monitoring query performance in database systems is often a manual and reactive process, proving inefficient for the early detection of issues that can impact application stability. This research aims to design and implement a system for automated and proactive query performance anomaly detection. This system utilizes data from MySQL's Performance Schema and applies an unsupervised machine learning algorithm, namely Isolation Forest, to identify queries with unusual behavior based on eight researcher-selected performance metrics. The detection process is implemented to run periodically in the background and send early notifications via email. Experiments were conducted by varying the contamination parameter, with the model's performance evaluated using Precision, Recall, and F1-Score metrics. The experimental results indicate that the configuration with contamination=0.1 yielded the most optimal performance, achieving an F1-Score of 0.39 and a Recall of 100% for the anomaly class. The developed system successfully demonstrated its ability to detect various types of anomalies, including the N+1 query problem, and offers an efficient solution to proactively improve database system performance.