设为首页 加入收藏

TOP

MySQL慢查询日志(SlowQueryLog)(三)
2015-07-24 11:32:15 来源: 作者: 【 】 浏览:10
Tags:MySQL 查询 日志 SlowQueryLog
low select * from tb_slow Count: 1 Time=0.20s (0s) Lock=0.00s (0s) Rows=1.0 (1), root[root]@localhost select count(*) from tb_slow Count: 1 Time=1.57s (1s) Lock=0.00s (0s) Rows=83.0 (83), root[root]@localhost select table_schema,table_name,count(*) from tb_slow group by table_schema,table_name order by N,N #以下是按照最大耗用时间排最后,只显示2条的方式格式化日志文件 suse11b:~ # mysqldumpslow -r -t 2 /var/lib/mysql/suse11b-slow.log Reading mysql slow query log from /var/lib/mysql/suse11b-slow.log Count: 1 Time=1.57s (1s) Lock=0.00s (0s) Rows=83.0 (83), root[root]@localhost select table_schema,table_name,count(*) from tb_slow group by table_schema,table_name order by N,N Count: 4 Time=16.87s (67s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost insert into tb_slow select * from tb_slow #获取mysqldumpslow的帮助信息 suse11b:~ # mysqldumpslow --help 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 #query的次数 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
首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇mysql流程函数存储引擎InnoDB简单.. 下一篇linux下导入、导出mysql数据库命令

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·nginx 监听一个端口 (2025-12-25 00:19:30)
·整个互联网就没有一 (2025-12-25 00:19:27)
·囧次元最新官网入口 (2025-12-25 00:19:24)
·如何利用Python做数 (2025-12-24 23:48:36)
·如何使用python进行 (2025-12-24 23:48:34)