teketeke_55の日記

技術メモとか

mysqldumpslow

mysqlのslow.logを読み取って集計してくれるtool

使い方

 mysqldumpslow slow.log > result.txt

詳細はhelpで確認

 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 (t, at, l, al, r, ar etc), 'at' is default
  -r           reverse the sort order (largest last instead of first)
  -t NUM       just show the top n queries
  -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)
  -l           don't subtract lock time from total time