1. 程式人生 > >MySQL慢查詢日誌釋疑總結

MySQL慢查詢日誌釋疑總結

#  mysqldumpslow --help
Usage: mysqldumpslow [ OPTS... ] [ LOGS... ]
Parse and summarize the MySQL slow query log. Options are
  --verbose    verbose  #顯示詳細資訊
  --debug      debug    #除錯模式下執行。
  --help       write this text to standard output
  -v           verbose #顯示詳細資訊
  -d           debug   #除錯模式下執行。
  -s ORDER     what to sort by (al, at, ar, c, l, r, t), 'at'
is default  排序方式,at是預設方式
                al: average lock time  #平均鎖定時間排序
                ar: average rows sent  #平均傳送行數排序
                at: average query time #平均查詢時間排序
                 c: count              #執行次數排序
                 l: lock time          #鎖定時間排序
                 r: rows sent          #總結果行數排序
                 t: query time         #總查詢時間排序
  -r           reverse the sort order (largest last instead of first) 
               #倒序資訊排序
  -t NUM       just show the top n queries  
               #只顯示前n個查詢
  -a           don't abstract all numbers to N and strings to 'S'
  -n NUM       abstract numbers with at least n digits within names
  -g PATTERN   grep: only consider stmts that include this string
               #根據字串篩選慢查詢日誌
  -h HOSTNAME  hostname of db server for *-slow.log filename (can be wildcard),
               default is '*', i.e. match all
               #根據伺服器名稱選擇慢查詢日誌
  -i NAME      name of server instance (if using mysql.server startup script)
               #根據伺服器MySQL例項名稱選擇慢查詢日誌。
  -l           don't subtract lock time from total time  
               #不要從總時間減去鎖定時間