MySQL slow query supports millisecond settings _ MySQL

Source: Internet
Author: User
MySQL slow query supports setting bitsCN.com in milliseconds
MySQL slow query supports millisecond settings MySQL slow query itself does not support the ms level (requires patching), but for MySQL 5.21 +, the minimum value of long_query_time is 0 (the minimum value is 1 s in versions earlier than 5.2.1), and the unit is s. If you specify ms, the ms part will be ignored. In fact, this is a disguised millisecond level, for example, if the query time is greater than 0.1 ms, it will be recorded in the slow log. we can set global long_query_time =;
Test:
1. directly set global long_query_time = 0.1. all queries with a query time greater than 0.1 seconds will be recorded in the slow log. after setting, log out and log on to mysql again> set global long_query_time = 0.1; query OK, 0 rows affected (0.00 sec) mysql> exitBye-bash-3.2 $
2. run a query of 0.2 seconds to check whether the query is recorded in mysql> select sleep (0.2); + ------------ + | sleep) | + ------------ + | 0 | + ------------ + 1 row in set (0.21 sec) # administrator command: Quit; # Time: 120412 15:39:15 # User @ Host: root [root] @ localhost [] # Query_time: 0.202244 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0 SET timestamp = 1334216355; select sleep (0.2 ); the query author RogerZhuobitsCN.com has been recorded in the slow log.

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.