Treffer: Benchmarking PHP–MySQL Communication: A Comparative Study of MySQLi and PDO Under Varying Query Complexity.
Weitere Informationen
Efficient interaction between PHP (Hypertext Preprocessor) applications and MySQL databases is essential for the performance of modern web systems. This study systematically compares the two most widely used PHP APIs for working with MySQL databases—MySQLi (MySQL Improved extension) and PDO (PHP Data Objects)—under identical experimental conditions. The analysis covers execution time, memory consumption, and the stability and variability of results across different types of SQL (Structured Query Language) queries (simple queries, complex JOIN, GROUP BY/HAVING). A specialized benchmarking tool was developed to collect detailed metrics over several hundred repetitions and to enable graphical and statistical evaluation. Across the full benchmark suite, MySQLi exhibits the lowest mean wall-clock execution time on average (≈15% overall). However, under higher query complexity and in certain connection-handling regimes, PDO prepared statement modes provide competitive latency with improved predictability. These results should be interpreted as context-aware rankings for the tested single-host environment and workload design, and as a reusable benchmarking framework intended for replication under alternative deployment models. Statistical analysis (Kruskal–Wallis and Mann–Whitney tests) confirms significant differences between the methods, while Box-plots and histograms visualize deviations and the presence of outliers. Unlike earlier studies, this work provides a controlled and replicable benchmarking environment that tests both MySQLi and PDO across multiple API modes and isolates the impact of native versus emulated prepared statements. It also evaluates performance under complex-query workloads that reflect typical reporting and analytics patterns on the ClassicModels schema. To our knowledge, no previous study has analyzed these factors jointly or provided a reusable tool enabling transparent comparison across PHP–MySQL access layers. The findings provide empirical evidence and practical guidelines for choosing the optimal API depending on the application scenario, as well as a tool that can be applied for further testing in various web environments. [ABSTRACT FROM AUTHOR]
Copyright of Electronics (2079-9292) is the property of MDPI and its content may not be copied or emailed to multiple sites without the copyright holder's express written permission. Additionally, content may not be used with any artificial intelligence tools or machine learning technologies. However, users may print, download, or email articles for individual use. This abstract may be abridged. No warranty is given about the accuracy of the copy. Users should refer to the original published version of the material for the full abstract. (Copyright applies to all Abstracts.)