mysqldumpslow
2023-09-11 14:16:16 时间
- -s 依据什么排序
al average lock time
ar average rows sent
at average query time
c count
l lock time
r rows sent
t query time - -t show top N queries
- -g grep: only consider stmts that include this string
Examples:
- 得到返回记录集最多的10个SQL
mysqldumpslow -s r -t 10 hostname-slow.log
- 得到访问次数最多的10个SQL
mysqldumpslow -s c -t 10 hostname-slow.log
- 按时间排序的前10SQL中含有'left join'的
mysqldumpslow -s t -t 10 -g 'left join' hostname-slow.log