默认显示时间信息,显示了该查询从开始到被清除各个阶段的执行时间。
mysql> show profile;
+----------------------+----------+
| Status | Duration |
+----------------------+----------+
| starting | 0.000090 |
| checking permissions | 0.000007 |
| Opening tables | 0.000048 |
| init | 0.000033 |
| System lock | 0.000006 |
| optimizing | 0.000018 |
| statistics | 0.000018 |
| preparing | 0.000015 |
| Sorting result | 0.000006 |
| executing | 0.000328 |
| Sending data | 0.000016 |
| Creating sort index | 0.000081 |
| end | 0.000004 |
| query end | 0.000006 |
| closing tables | 0.000003 |
| removing tmp table | 0.000005 |
| closing tables | 0.000004 |
| freeing items | 0.000068 |
| cleaning up | 0.000017 |
+----------------------+----------+
mysql> show profile; +----------------------+----------+ | Status | Duration | +----------------------+----------+ | starting | 0.000090 | | checking permissions | 0.000007 | | Opening tables | 0.000048 | | init | 0.000033 | | System lock | 0.000006 | | optimizing | 0.000018 | | statistics | 0.000018 | | preparing | 0.000015 | | Sorting result | 0.000006 | | executing | 0.000328 | | Sending data | 0.000016 | | Creating sort index | 0.000081 | | end | 0.000004 | | query end | 0.000006 | | closing tables | 0.000003 | | removing tmp table | 0.000005 | | closing tables | 0.000004 | | freeing items | 0.000068 | | cleaning up | 0.000017 | +----------------------+----------+其他查看方法:
mysql> show profile;
mysql> select * from information_schema.profiling;
mysql> select * from information_schema.profiling where query_id=6 or
mysql> show profile; #默认显示时间信息
mysql> show profile CPU,BLOCK IO; #(时间)加上 CPU,BLOCK IO 使用情况
mysql> show profile for query 6; #query_id=6的(时间)信息
mysql> show profile CPU for query 6; #query_id=6的cpu信息
mysql> show profile CPU limit 6; #前6个状态信息(前6行)
mysql> show profile CPU limit 6 offset 2;#第2行起前6个状态信息(前2~7行)