这个工具是解析慢查询日志,汇总显示使用的,这个工具汇总sql不会显示具体的值,会抽象这些值成N和'S',
-a和-n可以用来改变这种行为
shell> mysqldumpslow [options
] [log_file
...]
--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
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
-a don't abstract all numbers to N and strings to 'S' 不抽象数字成n,字符串成‘s'
-n NUM abstract numbers with at least n digits within names 抽象数字成至少n个数字
-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 在从时间中不排除锁时间
使用的例子:
/path/mysqldumpslow -s r -t 10 /database/mysql/slow-log
得到返回记录集最多的10个查询。
/path/mysqldumpslow -s t -t 10 -g “left join” /database/mysql/slow-log
得到按照时间排序的前10条里面含有左连接的查询语句。