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); www.2cto.com + ------------ + | 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 ); it can be seen that the query author RogerZhuo has been recorded in the slow log.