From: | Christian Robottom Reis <kiko(at)async(dot)com(dot)br> |
---|---|
To: | pgsql-docs(at)postgresql(dot)org |
Cc: | Guilherme Salgado <salgado(at)async(dot)com(dot)br> |
Subject: | log_min_duration_statement versus log_statement |
Date: | 2005-06-21 18:18:32 |
Message-ID: | 20050621181832.GR17728@www.async.com.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2005-06-29 01:22:55 | Re: log_min_duration_statement versus log_statement |
Previous Message | Michael Glaesemann | 2005-06-18 04:55:07 | Re: type casting reference? |