mysqlsla Quick Start

1. What is mysqlsla?

Simply means that the tool mysql log analysis, I mainly use it to analyze under mysql slow log.

2. Download

http://hackmysql.com/mysqlsla

3, installation

takes

cd

perl Makefile.PL

make && make install

4, run

mysqlsla -lt slow /tmp/slow.log

Developed through this type of log parameters, mainly slow, general, binary, msl, udl, through the development is slow when analyzing log slow.  )

At this point it might appear the following error message:

Resolve as follows:

yum install perl-Time-HiRes

There follows an error, the method is also in red box office may occur

Another possible error, the following process is also shown in

 

So ok! Because this is not my data, so we look for empty time performance

5, command Parameter Description

1) -log-type (-lt) type logs: 
通过这个参数来制定log的类型,主要有slow, general, binary, msl, udl,分析slow log时通过制定为slow. 

2) -sort: 
制定使用什么参数来对分析结果进行排序,默认是按照t_sum来进行排序。 
t_sum:按总时间排序 
c_sum:按总次数排序 
c_sum_p: sql语句执行次数占总执行次数的百分比。 

3) -top: 
显示sql的数量,默认是10,表示按规则取排序的前多少条 

4) –statement-filter (-sf) [+-][TYPE]: 
过滤sql语句的类型,比如select、update、drop. 
[TYPE]有SELECT, CREATE, DROP, UPDATE, INSERT,例如"+SELECT,INSERT",不出现的默认是-,即不包括。 

5) db:要处理哪个库的日志: 

郑州妇科医院:http://yyk.familydoctor.com.cn/sysdfkyy/

例如,只取backup库的select语句、按c_sum_p排序的前2条记录 
mysqlsla -lt slow -sort c_sum_p  -sf  "+select" -db backup -top 2  /tmp/127_slow.log

6、统计参数说明( http://www.jb51.net/article/29769.htm 

1)queries total: 总查询次数   
2)unique:去重后的sql数量   
3)sorted by : 输出报表的内容排序 最重大的慢sql统计信息, 包括 平均执行时间, 等待锁时间, 结果行的总数, 扫描的行总数.   
(t_sum:按总时间排序;c_sum:按总次数排序;c_sum_p: sql语句执行次数占总执行次数的百分比) 
4)Count: sql的执行次数及占总的slow log数量的百分比.   
5)Time: 执行时间, 包括总时间, 平均时间, 最小, 最大时间, 时间占到总慢sql时间的百分比.   
6)95% of Time: 去除最快和最慢的sql, 覆盖率占95%的sql的执行时间.   
7)Lock Time: 等待锁的时间.   
8)95% of Lock: 95%的慢sql等待锁时间.   
9)Rows sent: 结果行统计数量, 包括平均, 最小, 最大数量.   
10)Rows examined: 扫描的行数量.   
11)Database: 属于哪个数据库.  
12)Users: 哪个用户,IP, 占到所有用户执行的sql百分比.  
13)Query abstract: 抽象后的sql语句.  

14)Query sample: sql语句.


Guess you like

Origin blog.51cto.com/14337216/2425205