X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 00528529BC for ; Tue, 28 Jun 2005 22:23:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01550-05 for ; Wed, 29 Jun 2005 01:22:57 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id 8320B529B4 for ; Tue, 28 Jun 2005 22:22:56 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j5T1Mt721527; Tue, 28 Jun 2005 21:22:55 -0400 (EDT) From: Bruce Momjian Message-Id: <200506290122.j5T1Mt721527@candle.pha.pa.us> Subject: Re: log_min_duration_statement versus log_statement In-Reply-To: <20050621181832.GR17728@www.async.com.br> To: Christian Robottom Reis Date: Tue, 28 Jun 2005 21:22:55 -0400 (EDT) Cc: pgsql-docs@postgresql.org, Guilherme Salgado X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/32 X-Sequence-Number: 3125 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@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@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073