Optimizing the Execution Time of JOIN Queries and Subqueries Using MySQL
DOI:
https://doi.org/10.59934/jaiea.v5i2.1872Keywords:
Execution Time, Join, MySQL, Query Optimisation, SubqueryAbstract
Relational database systems form the backbone of modern information management. However, the escalating volumes of data and increasing complexity of queries present substantial performance challenges in data retrieval operations. This study investigates the execution time differences between Subqueries and five join methods: Inner Join, Left Join, Right Join, AsOf Join and Lateral Join, in MySQL environments. An experimental methodology was employed, utilising two simulated relational tables containing 100, 1,000, and 10,000 rows of data. Each query method was executed three times under identical system conditions to establish reliable average execution times. The findings demonstrate that join operations substantially outperform subqueries across all tested datasets. Inner Join, Left Join and Right Join maintained execution times below 0.04 seconds, even with the most extensive dataset. Conversely, subqueries exhibited significant performance degradation, with execution times increasing to tens of seconds as the data volume increased. This performance disparity stems from the iterative processing inherent to subqueries, which intensifies proportionally with dataset scale, whereas join operations leverage more efficient simultaneous data processing and merging algorithms. The research concludes that join methods constitute the more appropriate choice for medium to large-scale data scenarios, offering practical optimisation guidance for database developers and administrators implementing MySQL-based systems.
Downloads
References
C. A. Putra, R. Pratama, and T. Sutabri, “Analisis Manfaat Machine Learning Pada Next-Generation Firewall Sophos Xg 330 Dalam Mengatasi Serangan Sql Injection,” J. Manaj. Inform. Sist. Inf., vol. 6, pp. 197–204, 2023.
A. Misbullah, Nazaruddin, Rasudin, and Zulfan, “Analisa Proses Migrasi Mysql Non-Cluster Ke Cluster Dalam Menangani Fail-Over Sistem,” J. Pendidik. Teknol. Inf., vol. 4, pp. 40–49, 2020.
E. Budiman, M. Fadli, D. Kurniawan, and E. R. Susanto, “Tinjauan Literatur Dengan Pendekatan Systematic Literature Review Untuk Optimasi Kueri Dalam Basis Data,” J. Ilm. Tek. dan Ilmu Komput., vol. 4, no. 2, pp. 82–91, 2025.
Vasudevan Senathi Ramdoss, “Optimizing Database Queries: Cost And Performance Analysis,” Int. J. Sci. Res. Arch., vol. 2, no. 2, pp. 293–297, Aug. 2021, doi: 10.30574/ijsra.2021.2.2.0025.
T. Oktavia and S. Sujarwo, “Evaluation of Sub Query Performance in SQL Server,” EPJ Web Conf., vol. 68, p. 00033, Mar. 2014, doi: 10.1051/epjconf/20146800033.
B. Triaji, W. Andriyani, T. Suprawoto, M. A. Nugroho, and R. Kartadie, “Query Execution Performance Analysis of Column-Oriented Database in Dashboard,” J. Intell. Softw. Syst., vol. 1, no. 2, p. 122, Dec. 2022, doi: 10.26798/jiss.v1i2.768.
T. Alyas, A. Alzahrani, Y. Alsaawy, K. Alissa, Q. Abbas, and N. Tabassum, “Query Optimization Framework for Graph Database in Cloud Dew Environment,” Comput. Mater. Contin., vol. 74, no. 1, pp. 2317–2330, 2023, doi: 10.32604/cmc.2023.032454.
A. D. Riawati, M. Irfan, Khaeruddin, and A. Faruq, “High Availability Dynamic Sharding Database Server Dengan Metode Fail Over dan Clustering,” J. Manaj. Inform. Sist. Inf., vol. 5, pp. 1–10, 2022.
E. Firmansyah, H. Firdaus, and S. Samidi, “Optimasi Performa Query Subsidi Debitur dengan Index and Table Partition, Subquery and Indexing, dan Parallel Query Execution,” J. Pendidik. dan Teknol. Indones., vol. 5, no. 6 SE-, pp. 1769–1785, Jul. 2025, doi: 10.52436/1.jpti.824.
Y. Remil, A. Bendimerad, R. Mathonat, P. Chaleat, and M. Kaytoue, “What Makes My Queries Slow?’: Subgroup Discovery For SQL Workload Analysis,” Aug. 2021, [Online]. Available: http://arxiv.org/abs/2108.03906
G. Raphaela et al., “Optimasi Query Sql Server Dengan Teknik Indexing Dan Performance Monitoring,” JATI (Jurnal Mhs. Tek. Inform., vol. 9, no. 2, pp. 3094–3099, 2025.
K. E. Permana, M. K. Sophan, A. Muntasa, and A. B. Rahmat, “Perbandingan Kinerja Query Sql Join Tables Dengan Menggunakan Index,” J. SimanteC, vol. 11, no. 2, pp. 241–248, 2023.
M. Raihan Siddik, M. Arief Hasan, A. Fajar Kesuma, N. Sari, S. Dwi Putri, and Q. Uyun Harahap, “Implementasi Query Tuning Untuk Peningkatan Performa Pada Database Barang Mini Market Nan,” JATI (Jurnal Mhs. Tek. Inform., vol. 9, no. 2, pp. 3183–3187, 2025, doi: 10.36040/jati.v9i2.13217.
N. Hettiarachchi and P. Yapa, “Advancements in SQL Query Optimization: A Review of Join Order and Index Selection,” in 2025 5th International Conference on Machine Learning and Intelligent Systems Engineering (MLISE), 2025, pp. 31–39. doi: 10.1109/MLISE66443.2025.11100192.
A. Sander and R. Wauer, “Integrating Terminologies Into Standard SQL: A New Approach For Research On Routine Data,” J. Biomed. Semantics, vol. 10, no. 1, p. 7, Dec. 2019, doi: 10.1186/s13326-019-0199-z.
A. Hajdini, L. Fazliu, and D. Gjoshi, “Comparative Study of Join Algorithms in MySQL: Cross, Inner, Outer, and Self Joins,” J. Comput. Data Technol., vol. 1, no. 1, pp. 1–9, Jun. 2025, doi: 10.71426/jcdt.v1.i1.pp1-9.
I. Sabek and T. Kraska, “The Case for Learned In-Memory Joins,” Mar. 2022, [Online]. Available: http://arxiv.org/abs/2111.08824
A. Meleková and M. Kvet, “Effect of JOIN Type on Query Performance,” in 2025 37th Conference of Open Innovations Association (FRUCT), 2025, pp. 179–184. doi: 10.23919/FRUCT65909.2025.11007985.
R. Marcus, “Learned Query Superoptimization,” Jul. 2023, [Online]. Available: http://arxiv.org/abs/2303.15308
A. H. Fathulloh and H. I. Adauwiyah, “Perbandingan Tingkat Efisiensi Waktu Query SELECT pada Database Interface Navicat dan SQLYog di MySQL DBMS,” Appl. Inf. Syst. Manag., vol. 4, no. 2, pp. 101–105, Oct. 2021, doi: 10.15408/aism.v4i2.18369.
S. C. Nurzanah, M. S. Armilah, F. Arianto, S. Supriadi, and H. P. Utomo, “Comparison of Support Vector Machine and Naïve Bayes to Sentiment Analysis of Military Barracks Program,” J. Comput. Networks, Archit. High Perform. Comput., vol. 7, no. 3, pp. 854–864, Jul. 2025, doi: 10.47709/cnahpc.v7i3.6515.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 Journal of Artificial Intelligence and Engineering Applications (JAIEA)

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.







