Mysqldumpslow Usage Example (slow query) _mysql

Source: Internet
Author: User

Mysqldumpslow is MySQL's own tool for analyzing slow queries.

Often use a few commands

-S order what to sort by (Al, in, AR, C, L, R, T), ' at ' is default
-T NUM just show the top n queries
The-G pattern grep:only Consider stmts the include this string
-R Reverse the sort order
-S, is the order sequence, mainly has

C,t,l,r and Ac,at,al,ar, respectively, are sorted by query times, query time, lock time, and number of records returned, preceded by a representative average of a
-T is the meaning of top N, which is to return the number of previous data
-G, you can write a regular matching pattern, case insensitive

Here are some examples

Here the n represents the number, and the different numbers can be represented as the same SQL statement

The above meaning is this 904 such statement, this statement maximum execution time 16.44s, altogether 14861s, the maximum lock 0.0.5 s, altogether locks the 45s

You can also use the-G option to use regular filtering

The-S at delegates are sorted by average query time

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.