Re: Patch proposal for log_duration - Mailing list pgsql-patches

From Tom Lane
Subject Re: Patch proposal for log_duration
Date
Msg-id 15581.1143736277@sss.pgh.pa.us
Whole thread Raw
In response to Patch proposal for log_duration  ("Guillaume Smet" <guillaume.smet@gmail.com>)
Responses Re: Patch proposal for log_duration
List pgsql-patches
"Guillaume Smet" <guillaume.smet@gmail.com> writes:
> As explained in the previous thread, we used to play with log_duration
> and log_min_error_statement to have the following behaviour:
> - log every duration so that we can have a global overview of the
> database activity;
> - log statement only for slowest queries.

I really find it pretty bizarre to want to log a duration without
logging the statement that caused it.  Seems like the
log_min_duration_statement parameter ought to be enough.  These logging
options are already messy and unintuitive, and adding still more odd
frammishes doesn't help that ...

Changing code without changing the associated comments isn't a good way
to get your ideas accepted, either, eg here:

          /* Only print duration if we previously printed the statement. */
!         if ((log_statement == LOGSTMT_ALL && save_log_duration == LOGDRTN_LOGGED) || save_log_duration ==
LOGDRTN_ALL)
              ereport(LOG,

The patch makes that comment a lie.  This is not acceptable coding practice.

            regards, tom lane

pgsql-patches by date:

Previous
From: "Guillaume Smet"
Date:
Subject: Patch proposal for log_duration
Next
From: "Kevin Grittner"
Date:
Subject: Re: Additional current timestamp values