About the Long_query_time settings, can be said to be a small MySQL bug?

Source: Internet
Author: User
Tags mysql slow query log

We know that for MySQL log function, we can completely control whether to write or not. Generally speaking, binlog we usually open, and for slow queries we generally debug and observe the execution speed of SQL statements at the time of development. But today we find a problem. When using show variables like ' log% '; to see if the slow log is turned on, discover off, use set global Log_low_queries=on, and succeed. While using show variales like ' long% ' when found to be 10, so want to change it to 1, divert use set global long_query_time=1, again query discovery or 10. Just hit it, use Select Sleep (10), log the logs, and use Select Sleep (1) is not really recorded. And the set return record is:

mysql> set global long_query_time=1;

Query OK, 0 rows Affected (0.00 sec)

Really did not change, suddenly think that it is necessary to restart the server, I think it is not, I am not modifying the configuration file. Finally want to reopen a conversation to see how. Re-open a session query show variables like ' long% '; Then why is it not reflected in the window that modifies it? Puzzled.

I hope the friends who meet this situation don't keep trying in a conversation like me. Find the reason, directly open the window can be tested.

In addition, the MySQL slow query log is written to the table's setting. Set global log_output= ' TABLE ';

Another parameter related to slow queries is log_queries_not_using_indexes, which is used to set whether a query that does not use an index is logged. When this query is turned on, if your log is recorded in a table, the query records from that table will be added each time you display a slow log statement.

If the log is written in a file. You can use the Mysqldumpslow tool to browse slow query log files. The tool I have not used, after the introduction of the.

Transferred from: http://blog.csdn.net/fengbangyue/article/details/6359509

About the Long_query_time settings, can be said to be a small MySQL bug?

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.