We have been playing with the MicroSecond patch that was on the blog a week or so ago.
The basic patch seems to work some times, however there appears to be some strange behavior or missing documentation on how to set the intial value or change it while in operation.
Reading the code, you seem to take the .cnf option as microseconds. So if I want the slow query time to be 500ms, I would set
long_query_time = 500000
log-slow-queries = /var/log/mysql-slow.log
in the my.cnf file
When I then startup mysql, I use show variables and see the value has been set to 0.500000 (floating point 1/2 sec, so would seem correct) and slow query logging is on.
If I then run a query using the command line client that takes .72 seconds, nothing shows up in the logs.
If I set the long_query_time = 0 in the cnf file, then everything shows up with proper microsecond timing. However any value other than 0 doesn’t seem to work properly.
for changing it at run time is the proper syntax:
set long_query_time=0.5; or
set long_query_time=500000;
dev-db2 ~ # mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18 to server version: 5.0.22-log
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> set GLOBAL @@long_query_time=0.7;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘@@long_query_time=0.7’ at line 1
mysql>