Query time result in MySQL w/ PHP

前端 未结 4 567
独厮守ぢ
独厮守ぢ 2020-12-05 03:07

Is there a way that I can get the time of a MySQL query (specifically with PHP)? The actual time it took to complete the query, that is.

Something such as: Results 1

4条回答
  •  借酒劲吻你
    2020-12-05 03:48

    There are two possibilities I can tell you now:

    • wrap ->execute() with microtime() and measure it yourself, possibly wrapping whole "querying" code snippet within a class / function
    • run EXPLAIN query of that query and see if you can read some values from the returned data

    Hope that helps.

提交回复
热议问题