1.查看profiling
2.開啓profiling
3.查看使用過的sql
4.查看query_id = 2 的情況
若出現以下4種說明sql寫的有問題,需要優化
converting HEAP to MyISAM 查詢結果太大,內存都不夠用了,往磁盤上搬了
Creating tmp table 創建臨時表(拷貝數據到臨時表,用完在刪除)
Copying to tmp table on disk 把內存中臨時表複製到磁盤
locked 鎖定
show profile 的格式如下:
SHOW PROFILE [type [, type] ... ]
[FOR QUERY n]
[LIMIT row_count [OFFSET offset]]
type:
ALL
| BLOCK IO
| CONTEXT SWITCHES
| CPU
| IPC
| MEMORY
| PAGE FAULTS
| SOURCE
| SWAPS