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 E37435284B for ; Tue, 21 Jun 2005 15:18:48 -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 68871-10 for ; Tue, 21 Jun 2005 18:18:42 +0000 (GMT) Received: from frodo.hserus.net (frodo.hserus.net [204.74.68.40]) by svr1.postgresql.org (Postfix) with ESMTP id 27C2E52812 for ; Tue, 21 Jun 2005 15:18:38 -0300 (ADT) Received: from 200-171-140-32.dsl.telesp.net.br ([200.171.140.32]:48488 helo=anthem.async.com.br) by frodo.hserus.net with esmtps (Cipher TLSv1:EDH-RSA-DES-CBC3-SHA:168) (Exim 4.51 #0) id 1DknKV-000Lrd-Px for ; Tue, 21 Jun 2005 23:48:36 +0530 Received: from anthem.async.com.br (kiko@localhost.localdomain [127.0.0.1]) by anthem.async.com.br (8.12.3/8.12.3) with ESMTP id j5LIIXZo003576; Tue, 21 Jun 2005 15:18:33 -0300 Received: (from kiko@localhost) by anthem.async.com.br (8.12.3/8.12.3/Debian-7.1) id j5LIIWOf003572; Tue, 21 Jun 2005 15:18:32 -0300 From: Christian Robottom Reis Date: Tue, 21 Jun 2005 15:18:32 -0300 To: pgsql-docs@postgresql.org Cc: Guilherme Salgado Subject: log_min_duration_statement versus log_statement Message-ID: <20050621181832.GR17728@www.async.com.br> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Organization: Async Open Source, Brazil User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/31 X-Sequence-Number: 3124 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