February 14, 2019

MySQL commands - mysqldumpslow utility

MySQL mysqldumpslow utility commands


mysqldumpslow  -- Parse and summarize the MySQL slow query log.

mysqldumpslow [options] [log_file ...]
mysqldumpslow --help
mysqldumpslow --version

mysqldumpslow
mysqldumpslow /var/log/mysql/mysql-slow.log
mysqldumpslow -t 10 /var/lib/mysql/mysql-slow-query.log
mysqldumpslow -a -s c -t 10 /var/lib/mysql/mysql-dump-slow.log
mysqldumpslow -a -s r -t 5 /var/log/mysql/mysql-slow-query.log

mariadb-dumpslow is a symlink to mysqldumpslow

mysql dump slow options:   --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

Related MySQL Articles: mysqldump commands  MySQL mysqlreplicate cheatsheet


2 comments: