Skip site navigation (1) Skip section navigation (2)

Re: log_min_duration_statement versus log_statement

From: Christian Robottom Reis <kiko(at)async(dot)com(dot)br>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-docs(at)postgresql(dot)org,Guilherme Salgado <salgado(at)async(dot)com(dot)br>
Subject: Re: log_min_duration_statement versus log_statement
Date: 2005-06-29 19:40:20
Message-ID: 20050629194019.GS17063@www.async.com.br (view raw or flat)
Thread:
Lists: pgsql-docs
On Tue, Jun 28, 2005 at 09:22:55PM -0400, Bruce Momjian wrote:
> I think you are confused because log_min_duration_statement is really
> about _when_ to log (duration > ? ms), and what to log (the statement).

Right. In a way it is an "additional option" that acts independently of
log_statement and log_duration, and as such, should be described or even
categorized separately.

> OK, what if we change the documentaiton to be:
> 
> 	log_min_duration_statement = 1000 # Log all statements whose
> 	                 # execution time exceeds the value, in
> 	                 # milliseconds.  -1 disables. Zero logs
> 	                 # all statements and their durations.

Well, I think the confusion that we had (interaction between
log_min_duration_statement and log_statement and log_duration) isn't
really cleared up (this isn't the first time I've seen people ask me
about it at the support center here).

> Also, if you set log_min_duration_statement = 1000, it will print every
> statement which takes over 1 second, and its duration.  Are you not
> seeing that happen?

I do see it happen, but when log_duration and log_statement are enabled
you often fail to see the double-logging. log_min_duration_statement is
really an independent option that should be in a separate category.

My suggestion:

    - Move log_min_duration_statement out of the "when/what" to log
      categories, and put it under an "Additional logging" heading.

    - Change the comment to say:

        # Log all statements whose execution time exceeds this value.
        # Note that this setting is independent of the log_statement and
        # log_duration options above; if you set both log_statement and
        # log_min_duration_statement you will get statements logged as
        # per the "When to log" options, with long-running statements
        # possibly logged twice.
        #
        # Time in milliseconds. -1 disables. Zero logs all statements
        # and their durations.
        log_min_duration_statement = 1000 

            (sorry for the formatting fix, but it really improved
            readability; it's not critical of course)

You could just use the second half of the suggestion, but moving it out
of the section probably matches better the mental model we are trying
to suggest to end-users.

I agree the comment still isn't the clearest, but the only way to really
clarify would be to change the behaviour of log_min_duration_statement
to really be a "When" type of option (i.e., only controlled when to log,
and having the "What" options define what).

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3376 0125

In response to

pgsql-docs by date

Next:From: Josh BerkusDate: 2005-06-29 21:32:55
Subject: Re: log_min_duration_statement versus log_statement
Previous:From: Bruce MomjianDate: 2005-06-29 01:22:55
Subject: Re: log_min_duration_statement versus log_statement

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group