Adaptive MySQL Index Optimization based on Decision Trees and Random Forests
Online adjustment of MySQL indexes often lags behind traffic changes; the response time for DBAs to manually add indexes is lengthy, and static configurations cannot automatically shrink when workload declines. Curiously, when looking at the literature on this topic, most studies zero in on query latency and little else. Lock-waiting—which, in our experience, is often what actually brings a production system to its knees—gets barely a mention. And what makes matters worse, many of these proposals are so heavyweight in terms of model complexity that they become impractical to deploy in a real MySQL environment. This paper introduces three categories of features—query execution frequency, task wait time, and query latency—and trains recommendation models using decision trees and random forests respectively. We train decision‑tree and random‑forest models, rank columns by feature importance, and apply a Cardinality‑based post‑filter to discard low‑selectivity candidates. Experiments on one million synthetic records show that the decision‑tree scheme reduces query latency by 83.5%, while the random‑forest scheme achieves 87.5%. The traditional empirical index on username, owing to its high selectivity, achieves a 99.2% improvement—better than the machine‑learning solutions. However, the machine‑learning schemes use slightly less storage (107.70 MB vs. 116.72 MB for the empirical index) and offer the advantage of automation. Independent‑samples t‑tests reveal a significant difference between decision trees and random forests (t = 2.625, p = 0.0178), and between random forests and the empirical baseline (p < 0.001). The proposed solution interacts with MySQL 8.0 through standard SQL interfaces, requires no kernel modification, and provides a viable path for automated index tuning in specific scenarios.
Authors
- Qi Cui
Institutions
- Jiangsu University (CN)
- Jiangsu University Jingjiang College (CN)
Publication Details
- Journal
- Frontiers in Computing and Intelligent Systems
- Published
- 2026-11-29
- DOI
- https://doi.org/10.54097/6wn22s76
- Primary Topic
- Advanced Database Systems and Queries
- Type
- article
- Field-Weighted Citation Impact
- 0.00