Re: fix log_min_duration_statement logic error - Mailing list pgsql-patches

From Peter Eisentraut
Subject Re: fix log_min_duration_statement logic error
Date
Msg-id Pine.LNX.4.44.0310082244580.26413-100000@peter.localdomain
Whole thread Raw
In response to Re: fix log_min_duration_statement logic error  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: fix log_min_duration_statement logic error
Re: fix log_min_duration_statement logic error
List pgsql-patches
Bruce Momjian writes:

> > Imagine someone always having log_statement on and doing some sort of
> > aggregate query counting, say like grep '^LOG: query:' | wc -l.  Now that
> > someone (or maybe the admin on the night shift, to make it more dramatic)
> > also turns on log_min_statement_duration (or whatever it's spelled), say
> > to find the slowest queries: grep '^LOG: duration:' | sort -xyz | head
> > -10.  In order to guarantee the consistency of both results, you'd have to
> > log each query twice in this case.
>
> I guess.

Can we agree to this?

* If log_statement is on, then we log

query: %s

(Should it be "statement: %s"?)  %s has newlines suitable escaped; exactly
how is independent of this discussion.

* If log_duration is on, then we log

duration: x.xxx ms

The user can use log_pid to link it to the statement.  (If the user
doesn't like this, he can use log_min_duration_statement=0.)

* If log_min_duration_statement is triggered, then we log

duration: x.xxx ms; query: %s

* If log_statement is on and log_min_duration_statement is triggered, then
we (pick one):

(a) log both as per above, or
(b) log only log_min_duration_statement

* If log_duration is on and log_min_duration_statement is triggered, then
we (pick one):

(a) log both as per above, or
(b) log only log_min_duration_statement

--
Peter Eisentraut   peter_e@gmx.net


pgsql-patches by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Spanish translations of pg_dump and pg_resetxlog
Next
From: Bruce Momjian
Date:
Subject: Re: fix log_min_duration_statement logic error