Re: Reporting query duration

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reporting query duration
Date: 2002-08-30 04:44:09
Message-ID: 200208300444.g7U4i9V24877@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-08-30 04:46:05 contrib features during beta period
Previous Message Tom Lane 2002-08-30 04:42:00 Re: @(#)Mordred Labs advisory 0x0007: Remove DoS in PostgreSQL