Adaptive MySQL Index Optimization based on Decision Trees and Random Forests

Authors

  • Qi Cui College of Electronic and Information Engineering, Jiangsu University Jingjiang College, Zhenjiang, Jiangsu, 214500, China

DOI:

https://doi.org/10.54097/6wn22s76

Keywords:

MySQL, Index Optimization, Decision Tree, Random Forest, Adaptive

Abstract

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.

Downloads

Download data is not yet available.

References

[1] Meng, X. F., & Zhao, Y. W. (2020). A survey on integration of machine learning and database systems. Journal of Software.

[2] Qu, L. L., Han, N., Wei, S. J., et al. (2022). A survey on learned index recommendation techniques for databases. Journal of Chongqing University of Technology (Natural Science), (6), 189–199.

[3] Aken, D. V., Pavlo, A., Gordon, G. J., et al. (2017). Automatic database management system tuning through large-scale machine learning. In Proceedings of the 2017 ACM International Conference on Management of Data (SIGMOD) (pp. 1009–1024). https://doi.org/10.1145/3035918.3064031. DOI: https://doi.org/10.1145/3035918.3064029

[4] Qian, W. N., & Zhou, M. Q. (2021). Advances in intelligent database technologies. Chinese Journal of Computers.

[5] Kraska, T., Beutel, A., Chi, E. H., et al. (2018). The case for learned index structures. In Proceedings of the 2018 International Conference on Management of Data (SIGMOD) (pp. 489–504). https://doi.org/10.1145/3183716.3196909. DOI: https://doi.org/10.1145/3183713.3196909

[6] Zhang, T., & Cai, P. (2022). Lightweight MySQL index recommendation approach. Computer Engineering and Applications.

[7] Lai, S. C., Wu, X. Y., Peng, Y. W., et al. (2024). A survey on database index tuning techniques. Journal of Computer Research and Development, 61(4), 929–954.

[8] Chaudhuri, S., & Narasayya, V. (2019). Machine learning for database cost models. ACM Transactions on Database Systems. https://doi.org/10.1145/3327973. DOI: https://doi.org/10.1145/3327973

[9] Jiang, Y. F., & Li, M. (2023). Database performance tuning based on tree models. Information Technology.

[10] Leis, V., & Kipf, A. (2020). Load-aware index tuning. Proceedings of the VLDB Endowment. https://doi.org/10.14778/3407790.3407844. DOI: https://doi.org/10.14778/3407790.3407844

[11] Peng, G., Cai, P., Ye, K., et al. (2023). A data-driven index recommendation system for slow queries. In Proceedings of the 32nd ACM International Conference on Information and Knowledge Management (CIKM) (pp. 5086–5090). https://doi.org/10.1145/3583781.3614667. DOI: https://doi.org/10.1145/3583780.3614731

[12] Quinlan, J. R. (1993). C4.5: Programs for machine learning. Morgan Kaufmann.

[13] Breiman, L. (2001). Random forests. Machine Learning, 45(1), 5–32. https://doi.org/10.1023/A:1010933404324. DOI: https://doi.org/10.1023/A:1010933404324

[14] Zheng, B. W., & Zhao, F. Y. (2018). Index optimization for heterogeneous data based on decision tree classification algorithm. Electronic Science and Technology, 31(3), 48–51.

Downloads

Published

29-11-2026

Issue

Section

Articles

How to Cite

Cui, Q. (2026). Adaptive MySQL Index Optimization based on Decision Trees and Random Forests. Frontiers in Computing and Intelligent Systems, 19(1), 85-89. https://doi.org/10.54097/6wn22s76