From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Christian Robottom Reis <kiko(at)async(dot)com(dot)br> |
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 01:22:55 |
Message-ID: | 200506290122.j5T1Mt721527@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
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.
I think you are confused because log_min_duration_statement is really
about _when_ to log (duration > ? ms), and what to log (the statement).
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?
---------------------------------------------------------------------------
Christian Robottom Reis wrote:
>
> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Christian Robottom Reis | 2005-06-29 19:40:20 | Re: log_min_duration_statement versus log_statement |
Previous Message | Christian Robottom Reis | 2005-06-21 18:18:32 | log_min_duration_statement versus log_statement |