Mysql slow log analysis tools comparison

Mysql slow log to record the execution time is longer (more than long_query_time seconds) a log of the sql tools.

Opening of the slow log

There are two methods enabled:
1, in my.cnf through log-slow-queries [= file_name]
2, in the process of mysqld starts, specify – log-slow-queries [= file_name] option

Five commonly used tools

mysqldumpslow,
mysqlsla,
myprofi,
mysql-explain-slow-log,
mysqllogfilter

mysqldumpslow, mysql official slow query log analysis tools. output graphs are as follows:
dtbhrmv_480cb9vf8hq_b

Function, statistics of the different slow sql
1.Frequency (Count),
2.The implementation of the long period of time (Time),
3.Cumulative total time (Time),
4.Time to wait for lock (Lock),
5.Sent to the client the total number of rows (Rows),
6.The total number of scan lines (Rows),
7.Users as well as the sql statement itself (the abstract, then the format, such as limit 1, 20 with limit N, N said).

mysqlsla, hackmysql.com introduced a log analysis tool (the site also maintained mysqlreport, mysqlidxchk more practical, such as the mysql tools)

dtbhrmv_481fwd54r4n_b
Overall, very powerful. Data Report, are in favor of analysis of the reasons for the slow queries, including the implementation of frequency, the amount of data, query consumption.

Format as follows:
The total number of queries (queries total), after re-sql to the number of (unique)
Sort the contents of the output statements (sorted by)
Sql slow the most significant statistical information, including the average execution time, lock wait time, resulting in the total number of lines, the total number of scan lines.

Count, sql implementation of the frequency and the total percentage of the number of slow log.
Time, the execution time, including the total time, average time, minimum, maximum time, total time, the percentage of slow sql.
95% of Time, the fastest and the slowest to remove the sql, accounting for 95% coverage of the execution time of the sql.
Lock Time, the time waiting for locks.
95% of Lock, 95% of the slow sql lock wait time.
Rows sent, the results of the number of line statistics, including average, minimum, maximum number.
Rows examined, the number of scan lines.
Database, which belongs to the database
Users, which the user, IP, account for all users in the implementation of the percentage of the sql

Query abstract, abstract sql statement after

Query sample, sql statement

In addition to the above output, the official also provided a lot of customization parameters, is a good tool for rare.

mysql-explain-slow-log, written in German a perl script.

http://www.willamowius.de/mysql-tools.html

dtbhrmv_482dbz73bc2_b
Functions somewhat flawed, not only slow log all print to the screen, but only the number of no more than statistics. Not recommended.

mysql-log-filter, google code to find an analytical tool. provided two types of executable python and php scripts.

http://code.google.com/p/mysql-log-filter/

dtbhrmv_484d77sswt8_b

Function than mysqldumpslow, multi-query time statistics (average, maximum, cumulative), other features are similar mysqldumpslow.
Features in addition to statistical information, but also for the output of the layout and formatting done to ensure that the overall output of the simple. Like simple statements of friends recommended you.

myprofi, written in a pure php open source analysis tools. project on sourceforge.

http://myprofi.sourceforge.net/

dtbhrmv_485c5jzsbdw_b

Functions are set out in the overall number and type of slow queries to re-post the sql statement, the implementation of the total number and the percentage of the number of slow log.
Output from the overall style of view, than the mysql-log-filter but also concise. Save a lot of unnecessary content. The only want to look at sql statement and the implementation of the number of users, compared recommended.
Tools Basic statistics Advanced Statistics Script Advantage
mysqldumpslow Yes No perl mysql self
mysqlsla Yes Yes perl Powerful and complete data report, customization ability
mysql-explain-slow-log Yes NO perl  
mysql-log-filter Yes Partially python or php Simple output
myprofi Yes NO php Very concise
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

No Responses to “Mysql slow log analysis tools comparison”

Leave a Reply

Name:
Email:
Website:
Comment:
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>