Setting mysql slow query to less than 1 second

adwiv asked:

I have a heavily loaded LAMP system serving about 40 requests per second and doing about 300 mysql queries per second. Here is the output of mysqladmin status

Uptime: 5051  Threads: 1  Questions: 1418500  Slow queries: 0  Opens: 456  
Flush tables: 1  Open tables: 450  Queries per second avg: 280.835

However, the global status show about 5-10% table lock contention.

So, i want to figure out the queries that are taking longer time.

Is it possible to set the slow query log to less than one second? For my queries, even execution time of 100ms is high.


I answered:

Just set long_query_time to the value you want. If you want to log queries that take longer than 100ms, you would set it to 0.1.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.