MySQL slow query log analysis _ MySQL

Source: Internet
Author: User
Tags install perl mysql slow query log perl script
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.