Chinaunix首页 | 论坛 | 博客
  • 博客访问: 144110
  • 博文数量: 44
  • 博客积分: 2330
  • 博客等级: 大尉
  • 技术积分: 405
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-09 11:57
文章分类
文章存档

2012年(6)

2011年(32)

2010年(6)

分类: LINUX

2011-03-15 16:47:43

1,安装方法:
tar -xzvf mysqlsla-2.03.tar.gz
cd mysqlsla-2.03
perl Makefile.PL
make
make install
注:
需要Perl
及perl-DBI-1.52-.....rpm
 
 
2,使用方法:
 
# Basic operation: parse a MySQL slow or general log
mysqlsla --log-type slow LOG
mysqlsla --log-type general LOG
# Parse output from mysqlbinlog
# mysqlsla cannot directly parse binary logs
mysqlbinlog LOG │ mysqlsla --log-type binary -
# Parse a microslow patched slow log
mysqlsla --log-type msl LOG
# Replay a replay file
mysqlsla --replay FILE
# Parse a user-defined log specify its format
mysqlsla --log-type udl --udl-format FILE
# Let mysqlsla automatically determine the log type
mysqlsla LOG
 
3,结果内容分析:
 
Report for slow logs: yj-slow.log
共62.78千个查询,82个不重复的查询
62.78k queries total, 82 unique
报表排序字段t_sum
Sorted by 't_sum'
  平时执行时间,等待锁时间,结果行的总数,扫描的行总数
Grand Totals: Time 3.98k s, Lock 61 s, Rows sent 1.03G, Rows Examined 1.71G

______________________________________________________________________ 001 ___
sql的执行次数及占总的slow log数量的百分比.
Count         : 17.62k  (28.07%)
执行时间, 包括总时间, 平均时间, 最小, 最大时间, 时间占到总慢sql时间的百分比.
Time          : 2058.791678 s total, 116.824 ms avg, 142 �s to 4.259142 s max  (51.75%)
 去除最快和最慢的sql, 覆盖率占95%的sql的执行时间.
  95% of Time : 1793.826661 s total, 107.152 ms avg, 142 �s to 224.315 ms max
  等待锁的时间
Lock Time (s) : 48.925244 s total, 2.776 ms avg, 26 �s to 4.134769 s max  (79.68%)
95%的慢sql等待锁时间.
  95% of Lock : 688.517 ms total, 41 �s avg, 26 �s to 76 �s max
  结果行统计数量, 包括平均, 最小, 最大数量.
Rows sent     : 1 avg, 0 to 5 max  (0.00%)
扫描的行数量.
Rows examined : 31.76k avg, 3 to 64.36k max  (32.80%)
属于哪个数据库
Database      : UserData_dbo_sd2
哪个用户,IP, 占到所有用户执行的sql百分比
Users         :
 sd2_role@ 127.0.0.1 : 100.00% (17623) of query, 63.19% (39674) of all users
Query abstract:
抽象后的sql语句
SELECT * FROM roleinfo WHERE enable!=N AND owner='S';
Query sample:
示例 sql语句
select * from roleInfo where enable!=0 and owner='454561636';
阅读(1439) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~