MySQL Slow query

Source: Internet
Author: User

Open MySQL slow query under Windows
MySQL configuration file in Windows system is generally my.ini find [mysqld] under the Add
Log-slow-queries = F:\MySQL\log\mysqlslowquery.log
Long_query_time = 2

MySQL slow query enabled under Linux
MySQL configuration file in Windows system is generally my.cnf find [mysqld] under the Add
Log-slow-queries=/data/mysqldata/slowquery.log
long_query_time=2

Attention
Log-slow-queries = F:\MySQL\log\mysqlslowquery.log for slow query log storage location, generally this directory to have MySQL running account of the writable permission, generally set this directory as MySQL data storage directory;
Long_query_time=2 2 indicates that the query is more than two seconds before logging;


Add the log-queries-not-using-indexes parameter in my.cnf or My.ini to indicate a query that does not use an index under the record. Like what:
Log-slow-queries=/data/mysqldata/slowquery.log
long_query_time=2
Log-queries-not-using-indexes

Mysqldumpslow command

Official command for easy querying of slow SQL

Reference:

Http://kimi.it/326.html
http://kimi.it/category/mysql/

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.