Re: Reporting query duration - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Reporting query duration
Date
Msg-id 200208300444.g7U4i9V24877@candle.pha.pa.us
Whole thread Raw
In response to Re: Reporting query duration  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Reporting query duration
List pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > There is a TODO item:
> >     * Allow logging of query durations
> 
> > Currently there is no easy way to get a list of query durations in the
> > server log file.  My idea is to add query duration to the end of the
> > query string for 'debug_print_query'.  My only problem is that to print
> > the duration, I would have to print the query _after_ it is executed,
> > rather than before.
> 
> Well, that's what makes it a bad idea, eh?
> 
> I think the log entries should be separate: print the query text when
> you start, print the duration when you're done.  A little bit of
> postprocessing can reassemble the two entries.

How would someone reassemble them?  You would have to have the pid, I
assume.  Do we auto-enable pid output when we enable duration?  Yuck.
Maybe print the pid just for the query and timing lines if pid print
isn't enabled?

I would think printing it out together at the end would work.  We
already have several ways to see running queries.

--  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,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: @(#)Mordred Labs advisory 0x0007: Remove DoS in PostgreSQL
Next
From: "Christopher Kings-Lynne"
Date:
Subject: contrib features during beta period