梦想还是要有的,万一忘了咋办?

0%

mysqldumpslow

目录:

  • 工具介绍
  • 用法
  • help

工具介绍

mysqldumpsql 安装 mysql 自带工具,用于分析 slow sql日志文件。

用法

1
2
3
4
5
6

# 按照 count 从大到小排序 前 5 条
mysqldumpslow -s r -t 5 /var/log/mysql/slow.sql

# 按照 count 从小到大排序 前 5 条、
mysqldumpslow -r -s r -t 5 /var/log/mysql/slow.sql

Help

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
➜  ~ mysqldumpslow -h
Option h requires an argument
ERROR: bad option

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
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 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