MySQL Slow query

Source: Internet
Author: User

Some settings for MySQL slow query

1) Check to see if MySQL turns on slow query log
Show variables like ' Slow_query_log ';
2) Set non-indexed records to slow query log
set global log_queries_not_using_indexes=on;
3) See how long SQL is logged to the slow query log
Show variables like ' Long_query_time '
4) Turn on slow query log
Set global Slow_query_log=on

5) View the log record location
Show variables like ' Slow_query_log_file '

6) Set the path of the slow query

Set global slow_query_log_file= '/home/mysql/mysql_slow.log '


Slow-scan analysis tools

Mysqldumpslow

Pt-query-digest

MySQL Slow query

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.