Logging of queryies
Logging of queryies
От:
Peter Childs <blue.dragon@blueyonder.co.uk>
Дата:
After listening to a long talk on the glories of MySql (Its no better than Postgres, Postgres can do things MySql can't do and MySql can do things Postgres can't do... So I'm not going to change camp) but it is a good idea to know what the other camp thinks. One nice feature that was meationed was the ability to log queries by how long they took, I'm already loggin all my queries but this produces alot of junk. Is it possible to just log all the queries that take longer than say 30secs so I can then work on those that really take ages to speed my program up. Thanks in advance. Peter Childs
Re: Logging of queryies
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
I assume you are using log_duration. Yes, that does produce quite a bit of output. In fact, you need log_statement and log_pid at the same time so you can figure out the query that had that duration, and that can really fill the logs. We could change log_duration to take a time in milliseconds rather than just be a boolean, and print the duration _only_ if it was longer than the specified number of milliseconds. Not sure what value we would use to have it always print the duration, assuming 0 means off, or if we use 0 for always print, that values would we use for off, -1? Another feature would be to print the query if log_statement was not already true. How does that sound? --------------------------------------------------------------------------- Peter Childs wrote: > After listening to a long talk on the glories of MySql (Its no > better than Postgres, Postgres can do things MySql can't do and MySql can > do things Postgres can't do... So I'm not going to change camp) but it is > a good idea to know what the other camp thinks. > One nice feature that was meationed was the ability to log queries > by how long they took, I'm already loggin all my queries but this produces > alot of junk. Is it possible to just log all the queries that take longer > than say 30secs so I can then work on those that really take ages to speed > my program up. > > Thanks in advance. > > Peter Childs > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073