Slow query log Analysis tool Mysqldumpslow

Source: Internet
Author: User
Tags mysql slow query log

Mysqldumpslow is a slow query log analysis tool with MySQL, as its name implies, queries those SQL statements that are slow to query, thus analyzing the reason why SQL query efficiency is slow.


In general, the results of a Mysqldumpslow group query are similar, and when displaying statistical results, you can abstract numbers and strings into "N" and "S", respectively. Of course, you can also use the-A and-n options to modify these abstract behaviors.


Mysqldumpslow Query command


Mysqldumpslow [Options] [Log_file]


Mysqldumpslow Optional parameters (options), as follows:


   -A: Do not abstract numbers into N, strings are abstracted 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.00s (0s) lock=0.00s (0s) 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.00s (0s) lock=0.00s (0s) 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: Displays the number abstract as at least the specified number of digits



This article is from the "This person's IT World" blog, be sure to keep this source http://favccxx.blog.51cto.com/2890523/1730049

Slow query log Analysis tool Mysqldumpslow

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.