1. 程式人生 > >mysql profile explain slow_query_log分析優化查詢

mysql profile explain slow_query_log分析優化查詢

|Query |
+----------+------------+-----------------------------------+
0.00021500  | [email protected]@profiling |
0.05522700  | select count(*)from abc_posts|
+----------+------------+-----------------------------------+
2 rows in set (0.00 sec)
注意:Query_ID表示剛執行的查詢語句

show profile for query 2;
+--------------------------------+----------+
|Status 
| Duration |
+--------------------------------+----------+
|starting 
| 0.000021 |
| checking query cache for query | 0.000045 |
| checkingpermissions 
| 0.000007 |
| Openingtables 
| 0.000011 |
| Systemlock 
| 0.000004 |
| Tablelock 
| 0.000040 |
|init 
| 0.000012 |
|optimizing 
| 0.000005 |
|statistics 
| 0.000010 |
|preparing