mysqldumpslow使用
2016-04-24 10:24
459 查看
这个工具是解析慢查询日志,汇总显示使用的,这个工具汇总sql不会显示具体的值,会抽象这些值成N和'S',
-a和-n可以用来改变这种行为
--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条里面含有左连接的查询语句。
-a和-n可以用来改变这种行为
shell> [code]mysqldumpslow [options
] [log_file...][/code]
--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条里面含有左连接的查询语句。
相关文章推荐
- mysql max函数不能用在where条件中的案例
- MySQL绿色版的安装(mysql-5.6.22-win32.zip)
- 跟我一起学习MySQL技术内幕(第五版):(第二章学习日记10)
- [mysql] ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.
- mysql表的字符集uft8转换成gbk测试
- mysql ndb集群备份数据库和还原数据库的方法
- mysql 加了 skip-name-resolve不能链接数据库问题的解决方法
- mysql表名大小写敏感
- MySQL排错工具perror
- MySQL查询优化
- "Table 'mysql.plugin' doesn't exist"引发de血案
- 清空mysql的历史记录
- mysqldump 用法
- mysql5.5解压缩版安装步骤
- mysql管理工具
- install mysql on ubuntu
- mysql 做增量备份
- MySQL QA 入门序列
- mysql 源码安装
- MySQL数据库离线包安装与注册