Home » Performance » MySQL » MicroSeconds Slow Query patch
MicroSeconds Slow Query patch [message #190] Mon, 25 September 2006 20:40 Go to next message
aronrosenberg
Messages: 16
Registered: September 2006
Junior Member
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
Re: MicroSeconds Slow Query patch [message #192 is a reply to message #190 ] Tue, 26 September 2006 08:36 Go to previous messageGo to next message
vadimtk  is currently offline vadimtk
Messages: 12
Registered: August 2006
Junior Member
Hi,

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

Best,
Vadim.
Re: MicroSeconds Slow Query patch [message #195 is a reply to message #192 ] Tue, 26 September 2006 09:53 Go to previous messageGo to next message
aronrosenberg
Messages: 16
Registered: September 2006
Junior Member
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?

Re: MicroSeconds Slow Query patch [message #196 is a reply to message #195 ] Tue, 26 September 2006 11:10 Go to previous messageGo to next message
vadimtk  is currently offline vadimtk
Messages: 12
Registered: August 2006
Junior Member
Sorry, I did not copy it in web server dir
here is new link with new name:
http://www.mysqlperformanceblog.com/files/patches/patch.slow -micro.5.0.24a-1.diff
I did not test it with 5.0.22, but if patch is applied without error it should work.
Re: MicroSeconds Slow Query patch [message #197 is a reply to message #196 ] Tue, 26 September 2006 11:40 Go to previous messageGo to next message
aronrosenberg
Messages: 16
Registered: September 2006
Junior Member
Vadim,

Is the syntax correct that i referenced above about the my.cnf setting and the while running "SET" command?
Re: MicroSeconds Slow Query patch [message #198 is a reply to message #197 ] Wed, 27 September 2006 02:02 Go to previous messageGo to next message
vadimtk  is currently offline vadimtk
Messages: 12
Registered: August 2006
Junior Member
Hi,

Yes, there is a mess in settings:

in my.cnf you should use time in ms

long_query_time=300000


but in sql you should use time in sec:
set long_query_time=0.3; - this command changes time only in current session.

to change global:
set GLOBAL @@long_query_time=0.7;
Re: MicroSeconds Slow Query patch [message #203 is a reply to message #198 ] Wed, 27 September 2006 10:40 Go to previous messageGo to next message
aronrosenberg
Messages: 16
Registered: September 2006
Junior Member
I get a syntax error with set GLOBAL @@long_query_time=0.7;

No syntax error without the @@, but it doesn't hold the setting past the current session. Just SET @@long_query_time=0.7; works too, but is only session based.

Any ideas?
Re: MicroSeconds Slow Query patch [message #205 is a reply to message #203 ] Thu, 28 September 2006 04:14 Go to previous messageGo to next message
vadimtk  is currently offline vadimtk
Messages: 12
Registered: August 2006
Junior Member
Very strange - I tested it before recommending.
What exactly syntax error do you have ?
Re: MicroSeconds Slow Query patch [message #210 is a reply to message #190 ] Thu, 28 September 2006 11:54 Go to previous messageGo to next message
aronrosenberg
Messages: 16
Registered: September 2006
Junior Member
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>


Re: MicroSeconds Slow Query patch [message #212 is a reply to message #210 ] Fri, 29 September 2006 00:00 Go to previous messageGo to next message
vadimtk  is currently offline vadimtk
Messages: 12
Registered: August 2006
Junior Member
ok..

There are two ways that work for me too:

set global long_query_time=0.6;
set @@global.long_query_time=0.4;

Please note in second session you still will see old
value of long_query_time until you reconnect.

Re: MicroSeconds Slow Query patch [message #213 is a reply to message #212 ] Fri, 29 September 2006 00:10 Go to previous message
aronrosenberg
Messages: 16
Registered: September 2006
Junior Member
Thanks, that works properly for other sessions.
Previous Topic:MySQL instalation - OS, Version
Next Topic:Optimal database structure
Goto Forum:
  


Current Time: Mon Jul 6 19:50:53 EDT 2009

Total time taken to generate the page: 0.02393 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.