开启profiling:
mysql> set profiling =1;
查看profile状态
mysql> show variables like ‘%profil%’;
执行一个查询,如:
mysql> select count(*) from customer;
查看查询性能:
mysql> show profiles;
结果如:
查看第几个查询的性能:
mysql> show profile for query 32;
+—————————+———-+
| Status | Duration |
+—————————+———-+
| continuing inside routine | 0.000012 |
| checking permissions | 0.000006 |
| checking permissions | 0.000006 |
| Opening tables | 0.000017 |
| init | 0.000028 |
| System lock | 0.000009 |
| optimizing | 0.000020 |
| statistics | 0.000036 |
| preparing | 0.000027 |
| executing | 0.000005 |
| Sending data | 0.000053 |
| end | 0.000007 |
| query end | 0.000006 |
| closing tables | 0.000031 |
所以,你就可以查询后查性能了;
最后,关闭poriling
mysql> set profiling=off;
Mysql连接数、线程数、数据包