MySQL slow query log analysis bitsCN.com
The most basic is mysql's mysqlslowdump
Easy to use:
Mysqldumpslow-s c-t 20 host-slow.log
Parameters:
1.-s, sorting, c, t, l, r, and ac, at, al, and ar are sorted by query times, time, lock time, and returned Records respectively. Adding a is inverted.
2.-t, top n. keep up with the number to calculate the top number.
3.-g, followed by a regular expression.
First, mysqlsla is also a perl script,
Web: http://hackmysql.com/mysqlsla
At the same time, this website also has some other tools that look good.
This requires minor installation:
Tar xvfz mysqlsla-2.03.tar.gz
Cd mysqlsla-2.03
Perl Makefile. PL
Make
Make install
Note that perl is required!
# Yum install perl
# Yum install perl-Time-HiRes
The latter is because 2095 rows reported an error during the first running, so let's take a look, 2095 rows are
Use Time: HiRes qw (gettimeofday TV _interval );
Just install it. Not complex.
The operation is also relatively simple:
-Slow log: mysqlsla-lt slow. log
-General log: mysqlsla-lt general. log
-Binary log: mysqlbinlog bin. log | mysqlsla-lt binary
Mysqlsla-lt slow/data/database/slow. log
Note that lt = log type can also be used to analyze other log types of mysql.
The advantage of mysqlsla is that the analysis results are clear and we recommend that you use
BitsCN.com