MySQL Slow query

Source: Internet
Author: User
Tags set time

MySQL Slow query configuration
MySQL logs all SQL statements that execute more than the set time threshold of the Long_query_time parameter, and the slow query log is the SQL log

Turn on Slow Query method

Method One,

In the MySQL config file (under Windows My.ini,linux my.cnf)
Add the following mysqld in the

Log_slow_queries="D:\wamp\bin\mysql\mysql5. 5.28\mylog\slowquery. Log "Long_query_time = 1 Log -queries-not-using-indexes (if the queried SQL does not use an index (regardless of whether the table has an index), it is also logged)

Method Two,

Show variables like "slow%";

Set global Slow_query=1;

You can also add the item configuration under Configuration file mysqld

Global Slow_query=1long_query_time=1slow_query_log_file =/tmp/slow. Log

Method One is configured, the method two is invalid, the method is a priority!

MySQL Slow query

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.