Query time result in MySQL w/ PHP

前端 未结 4 570
独厮守ぢ
独厮守ぢ 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 04:00

    this may be help you

    http://dev.mysql.com/doc/refman/5.0/en/show-profile.html

    mysql> SET profiling = 1;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> DROP TABLE IF EXISTS t1;
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    mysql> CREATE TABLE T1 (id INT);
    Query OK, 0 rows affected (0.01 sec)
    
    mysql> SHOW PROFILES;
    +----------+----------+--------------------------+
    | Query_ID | Duration | Query                    |
    +----------+----------+--------------------------+
    |        0 | 0.000088 | SET PROFILING = 1        |
    |        1 | 0.000136 | DROP TABLE IF EXISTS t1  |
    |        2 | 0.011947 | CREATE TABLE t1 (id INT) |
    +----------+----------+--------------------------+
    

    greetings

提交回复
热议问题