PHP takes 90x longer to run query than MySQL client

前端 未结 4 621
轻奢々
轻奢々 2020-12-10 02:46

I\'m running a MySQL query via a command-line PHP script (prepared query using PDO on the mysqlnd driver). It\'s a simple query with a single left-join, returning 100 rows

4条回答
  •  猫巷女王i
    2020-12-10 03:09

    PDO uses resources to manipulates row results. Par that with an interpreted language (PHP) and you will have script that takes longer to process than it does for MySQL to return your results.

    NOTE: Using mysql_select_db() or mysqli_select_db() is much faster than PDO.

    To learn more about faster PHP Queries, see: PHP: What's the fastest way to query MySQL? Because PDO is painfully slow

提交回复
热议问题