log_min_duration_statement versus log_statement

Поиск
Список
Период
Сортировка
От Christian Robottom Reis
Тема log_min_duration_statement versus log_statement
Дата
Msg-id 20050621181832.GR17728@www.async.com.br
обсуждение исходный текст
Ответы Re: log_min_duration_statement versus log_statement  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-docs
Hello there,

    I've just discovered that our postgresql.conf and the related
documentation are a bit unclear when explaining how log_min_duration_statement
works. From the wording

    log_min_duration_statement = 1000 # Log all statements whose
                 # execution time exceeds the value, in
                 # milliseconds.  -1 disables. Zero logs
                 # all statements.

I would think that if I enabled it, it would override/control the statements
being logged. However, that's not how it behaves (at least in

    kiko@anthem:~$ psql -V
    psql (PostgreSQL) 7.4.7

) -- if I enable it /and/ log_statement is enabled as well, I get all
statements logged. In other words, the trailing sentence:

    # Zero logs all statements.

is confusing because it seems to imply that to log all statements you should
set log_min_duration_statement to zero.

I'd much prefer a behaviour change here (it would make it more obvious and
useful for log_min_duration_statement, which appears under "When to Log", to
control /when/ to log, and "What to log" to control /what/ to log :-), but I
think I'd have been less confused with a documentation change that explicitly
said that if log_statement or log_duration are on, then /all/ statements will
be logged, regardless of log_min_duration_statement.

Below is a snippet of that I have now (which is exactly what I want) in
my postgresql.conf. From visual inspection only, it would appear that
this configuration would print nothing (since nothing is defined under
"What to Log"). However, it does exactly what I want (only log
statements that run over 1s).

----------------------------------------------------------------------
# - When to Log -

#client_min_messages = notice   # Values, in order of decreasing detail:
                #   debug5, debug4, debug3, debug2, debug1,
                #   log, info, notice, warning, error

#log_min_messages = notice  # Values, in order of decreasing detail:
                #   debug5, debug4, debug3, debug2, debug1,
                #   info, notice, warning, error, log, fatal,
                #   panic

#log_error_verbosity = default   # terse, default, or verbose messages

#log_min_error_statement = panic # Values in order of increasing severity:
                 #   debug5, debug4, debug3, debug2, debug1,
                 #   info, notice, warning, error, panic(off)

log_min_duration_statement = 1000 # Log all statements whose
                 # execution time exceeds the value, in
                 # milliseconds.  -1 disables. Zero logs
                 # all statements.

silent_mode = false          # DO NOT USE without Syslog!

# - What to Log -

#debug_print_parse = false
#debug_print_rewritten = false
#debug_print_plan = false
#debug_pretty_print = false
#log_connections = false
#log_duration = false
#log_pid = false
#log_statement = false
#log_timestamp = false
#log_hostname = false
#log_source_port = false
----------------------------------------------------------------------

Opinions? Am I confused? Thanks for listening.

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

В списке pgsql-docs по дате отправления:

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: type casting reference?
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: log_min_duration_statement versus log_statement