你可以使用SHOW PROFILE Statement.
通过以下方式启用:
SET profiling = 1;
例如,我执行了一些查询,如下所示:
mysql> CREATE TABLE T1 (id INT);
mysql> use gesti;
mysql> show tables;
mysql> select * from orders limit 10;
mysql> show profiles;
+----------+------------+-------------------------------+
| Query_ID | Duration | Query |
+----------+------------+-------------------------------+
| 1 | 0.38483575 | CREATE TABLE T1 (id INT) |
| 2 | 0.00039525 | SELECT DATABASE() |
| 3 | 0.00604350 | show tables |
| 4 | 0.00075625 | select * from orders limit 10 |
+----------+------------+-------------------------------+
4 rows in set, 1 warning (0.00 sec)