# MicroSeconds Slow Query patch

**URL:** <https://forums.percona.com/t/microseconds-slow-query-patch/87>\
**Category:** Other MySQL® Questions\
**Created:** [September 25, 2006, 7:10pm UTC](https://forums.percona.com/t/microseconds-slow-query-patch/87 "2006-09-25T19:10:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aronrosenberg](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@aronrosenberg](https://forums.percona.com/u/aronrosenberg)\
**Post date:** [September 25, 2006, 7:10pm UTC](https://forums.percona.com/t/microseconds-slow-query-patch/87/1 "2006-09-25T19:10:04Z")

</div>

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;

Also, set GLOBAL doesn’t work for long\_query\_time

---

<div class="post-metadata">

**Author:** ![vadimtk](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadimtk/32/9528_2.png) [@vadimtk](https://forums.percona.com/u/vadimtk)\
**Post date:** [September 26, 2006, 7:06am UTC](https://forums.percona.com/t/microseconds-slow-query-patch/87/2 "2006-09-26T07:06:55Z")

</div>

Hi,

there was really small bug in the patch, it is fixed now - please  
re-download the patch again.

Best,  
Vadim.

---

<div class="post-metadata">

**Author:** ![aronrosenberg](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@aronrosenberg](https://forums.percona.com/u/aronrosenberg)\
**Post date:** [September 26, 2006, 8:23am UTC](https://forums.percona.com/t/microseconds-slow-query-patch/87/3 "2006-09-26T08:23:26Z")

</div>

Is the link correct, since that is the exact same patch that we are using. (just ran a diff on the patch against what we downloaded and no changes)

Would there be any reason that applying the patch against 5.0.22 would cause issues?

---

<div class="post-metadata">

**Author:** ![aronrosenberg](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@aronrosenberg](https://forums.percona.com/u/aronrosenberg)\
**Post date:** [September 28, 2006, 10:24am UTC](https://forums.percona.com/t/microseconds-slow-query-patch/87/4 "2006-09-28T10:24:27Z")

</div>

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 &#64;&#64;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 ‘&#64;&#64;long\_query\_time=0.7’ at line 1  
mysql\>

---

<div class="post-metadata">

**Author:** ![vadimtk](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadimtk/32/9528_2.png) [@vadimtk](https://forums.percona.com/u/vadimtk)\
**Post date:** [September 28, 2006, 10:30pm UTC](https://forums.percona.com/t/microseconds-slow-query-patch/87/5 "2006-09-28T22:30:33Z")

</div>

ok…

There are two ways that work for me too:

set global long\_query\_time=0.6;  
set &#64;&#64;global.long\_query\_time=0.4;

Please note in second session you still will see old  
value of long\_query\_time until you reconnect.
