MySQL slow query _ MySQL-mysql tutorial

Source: Internet
Author: User
Tags mysql tutorial mysql slow query log
I was shocked to see this name in MySQL slow query...

Isn't SQL expected to quickly query and obtain results? how can this concept be implemented.

I asked a buddy, who thought it was a man query: multiple queries at the same time.

So Google came up with the following results:

Slow query actually corresponds to the MySQL slow query log system, which is used to record slow SQL statements.

How can we determine that execution is slow? when you show variables like '% quer %' in MySQL, you can see the long_query_time attribute, which corresponds to the set comparison time.

When you see the long_query_time attribute, you can also see that the log_slow_queries status is OFF, which indicates that slow query is not enabled.

How to enable it?

1. in Linux

Find the mysql configuration file my. ini and add the slow query configuration statement below mysqld.

Log_slow_queries =/var/lib/mysql/mysql-slow.log.

Long_query_time = 10

2. Windows

Find the mysql configuration file my. ini and add the slow query configuration statement below mysqld.

Log_slow_queries = C:/mysql/mysql-slow.log

Long_query_time = 10

10 is the second, and the configuration must be restarted.

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.