打开show profile开关
set profiling = 1;
查看值 show variables like "%pro%";
mysql> show profile;
+--------------------------------+----------+
| Status | Duration |
+--------------------------------+----------+
| starting | 0.000364 |
| Waiting for query cache lock | 0.000154 |
| checking query cache for query | 0.000154 |
| checking privileges on cached | 0.000148 |
| checking permissions | 0.000156 |
| checking permissions | 0.000148 |
| checking permissions | 0.000148 |
| sending cached result to clien | 0.000156 |
| logging slow query | 0.000151 |
| cleaning up | 0.000148 |
+--------------------------------+----------+
进行性能调优