Mysql slow query analysis installation and use of mysqlsla in centos

Source: Internet
Author: User
Tags install perl
Description of yum-yinstallperlperl-DBIperl-CPANwgethackmysql.comscriptsmysqlsla-2.03.tar.gztarzxvfmysqlsla-2.03.tar.gzcdmysqlsla-2.03perlMakefile.PLmakemakeinstallmysqlsla-ltslowvarmysqllogmysql-slow.log statistical parameters? Qu

Yum-yinstall perl-DBI perl-CPAN wget http://hackmysql.com/scripts/mysqlsla-2.03.tar.gz tar zxvf mysqlsla-2.03.tar.gz cd mysqlsla-2.03 perl Makefile. PL make install mysqlsla-lt slow/var/mysql/log/mysql-slow.log statistical parameter description? Qu

Yum-y install perl-DBI perl-CPAN

WgetHttp://hackmysql.com/scripts/mysqlsla-2.03.tar.gz

Tar zxvfMysqlsla-2.03.tar.gz

CdMysqlsla-2.03

Perl Makefile. PL

Make

Make install

Mysqlsla-lt slow/var/mysql/log/mysql-slow.log

Statistical parameter description?

Queries total: total number of queries

Unique: Number of SQL statements after deduplication

Sorted by: sort the most important slow SQL statement statistics in the output report, including average execution time, lock wait time, total number of result rows, and total number of scanned rows.

Count: the number of SQL executions and percentage of the total slow log Count.

Time: the execution Time, including the total Time, average Time, minimum, maximum Time, and Time as a percentage of the total slow SQL Time.

95% of Time: removes the fastest and slowest SQL statements, and the SQL Execution Time with a coverage rate of 95%.

Lock Time: the waiting Time.

95% of Lock: 95% of slow SQL wait Lock time.

Rows sent: Number of result Rows, including average, minimum, and maximum.

Rows examined: number of Rows scanned.

Database: the Database to which it belongs.

Users: user and IP address, which account for the percentage of SQL statements executed by all Users.

Query abstract: abstract SQL statements.

Query sample: SQL statement.

Parameters

-Log-type (-lt) type logs:

This parameter is used to specify the log types, including slow, general, binary, msl, and udl. When analyzing slow logs, slow is used.

-Sort:

Specify the parameters used to sort the analysis results. The default value is t_sum.

T_sum is sorted by the total time, And c_sum is sorted by the total number of times

-Top:

Displays the number of SQL statements. The default value is 10, indicating the number of first SQL statements sorted by rules.

-Statement-filter (-sf) [+-] [TYPE]:

Filter the types of SQL statements, such as select, update, and drop. [TYPE] SELECT, CREATE, DROP, UPDATE, INSERT, for example, "+ SELECT, INSERT". The default value is-, that is, not included.

-Databases db:

The log of the database to be processed.

Example

Display the 10 SQL statements with the longest execution time in mysqlslow. log and write them to SQL _10.log.

Mysqlsla-lt slow-Sf "+ select"-top 10 mysqlslow. log> SQL _10.log

In the slow log mysqlslow. log, all the select and update slow SQL statements in the database for mydb are displayed, and the maximum number of queries is 100 in SQL _su100. SQL.

Mysqlsla-lt slow-Sf "+ select, update"-top 100-sort c_sum-db mydb mysqlslow. log> SQL _su100.log

From Weizhi note (Wiz) Time = 15:13:27

Zemanta

Original article address: mysql slow query and Analysis of mysql SLA Installation and Use in centos, thanks to the original author for sharing.

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.