MySQL slow query log analysis tool mysqldumpslow

Source: Internet
Author: User
Tags mysql slow query log

MySQL slow query log analysis tool mysqldumpslow

Mysqldumpslow is a log analysis tool that comes with mysql. As the name suggests, mysqldumpslow is used to query SQL statements that are slow in query. This analyzes the causes of slow SQL query efficiency.

Generally, the results of the mysqldumpslow grouping query are similar. When displaying the statistical results, the numbers and strings can be abstracted into "N" and "S ". Of course, you can also use the-a and-n options to modify these abstract behaviors.

Mysqldumpslow query command

Mysqldumpslow [options] [log_file]

The following is an optional parameter (options) for mysqldumpslow:

-A: Do not abstract numbers into N, and strings into S.

Example:

Mysql % mysqldumpslow/home/mysql/logs/slow_query.log
Reading mysql slow query log from/home/mysql/logs/slow_query.log

Count: 1 Time = 0.00 s (0 s) Lock = 0.00 s (0 s) Rows = 0.0 (0), FAVDBA [FAVDBA] @ [10.1.45.51]
# Schema: Last_errno: N Killed: N
# Query_time: N. N Lock_time: N. N Rows_sent: N Rows_examined: N Rows_affected: N
# Bytes_sent: N
SET timestamp = N;
SELECT EVENT_NAME, EVENT_SCHEMA, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS

Mysql % mysqldumpslow-a/home/mysql/logs/slow_query.log

Reading mysql slow query log from/home/mysql/logs/slow_query.log

Count: 1 Time = 0.00 s (0 s) Lock = 0.00 s (0 s) Rows = 0.0 (0), FAVDBA [FAVDBA] @ [10.1.45.51]
# Schema: Last_errno: 0 Killed: 0
# Query_time: 0.004095 Lock_time: 0.002907 Rows_sent: 0 Rows_examined: 0 Rows_affected: 0
# Bytes_sent: 140
SET timestamp = 1451270206;
SELECT EVENT_NAME, EVENT_SCHEMA, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS
 

-N N: The number is abstracted to at least the specified number of digits.

This article permanently updates the link address:

Related Article

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.