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 E1BBF5292D for ; Fri, 1 Jul 2005 10:32:30 -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 02858-04 for ; Fri, 1 Jul 2005 13:32:22 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id 45B365287E for ; Fri, 1 Jul 2005 10:32:20 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j61DWDn26481; Fri, 1 Jul 2005 09:32:13 -0400 (EDT) From: Bruce Momjian Message-Id: <200507011332.j61DWDn26481@candle.pha.pa.us> Subject: Re: log_min_duration_statement versus log_statement In-Reply-To: <200506291432.56196.josh@agliodbs.com> To: josh@agliodbs.com Date: Fri, 1 Jul 2005 09:32:13 -0400 (EDT) Cc: Christian Robottom Reis , pgsql-docs@postgresql.org, Guilherme Salgado X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=ELM1120224733-1456-0_ Content-Transfer-Encoding: 7bit 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: 200507/3 X-Sequence-Number: 3129 --ELM1120224733-1456-0_ Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Josh Berkus wrote: > Bruce, > > > 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). > > No, I see what Christian is complaining about. If one sets > log_statement="All", then all statements will be logged regardless of > duration or the setting in log_min_duration_statement. So it should > actually read: > > log_min_duration_statement = 1000 # Log all statements whose > # execution time exceeds the value, in > # milliseconds. -1 disables. This is in addition to > # any statements logged according to > log_statement. > > I'm with Christian on wanting to change the behavior so that it does what > the comments says it does currently, but I don't think we'll get that done > today. I have updated the documentation to be clearer that this is a complex setting. The old docs were not very clear on this point. Attached and applied. I don't know we can ever combine this with log_statement and log_duration because log_statement prints when the statement starts, not when it completes. -- 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 --ELM1120224733-1456-0_ Content-Transfer-Encoding: 7bit Content-Type: text/plain Content-Disposition: inline; filename="/bjm/diff" Index: doc/src/sgml/runtime.sgml =================================================================== RCS file: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v retrieving revision 1.332 diff -c -c -r1.332 runtime.sgml *** doc/src/sgml/runtime.sgml 26 Jun 2005 19:16:04 -0000 1.332 --- doc/src/sgml/runtime.sgml 1 Jul 2005 13:25:51 -0000 *************** *** 2628,2643 **** ! Sets a minimum statement execution time (in milliseconds) ! that causes a statement to be logged. All SQL statements ! that run for the time specified or longer will be logged with ! their duration. Setting this to zero will print ! all queries and their durations. Minus-one (the default) ! disables the feature. For example, if you set it to ! 250 then all SQL statements that run 250ms ! or longer will be logged. Enabling this option can be ! useful in tracking down unoptimized queries in your applications. ! Only superusers can change this setting. --- 2628,2644 ---- ! Logs the statement and its duration on a single log line if its ! duration is greater than or equal to the specified number of ! milliseconds. Setting this to zero will print all statements ! and their durations. Minus-one (the default) disables the ! feature. For example, if you set it to 250 ! then all SQL statements that run 250ms or longer will be ! logged. Enabling this option can be useful in tracking down ! unoptimized queries in your applications. This setting is ! independent of log_statement and ! log_duration. Only superusers can change ! this setting. Index: src/backend/utils/misc/postgresql.conf.sample =================================================================== RCS file: /cvsroot/pgsql/src/backend/utils/misc/postgresql.conf.sample,v retrieving revision 1.148 diff -c -c -r1.148 postgresql.conf.sample *** src/backend/utils/misc/postgresql.conf.sample 26 Jun 2005 03:03:41 -0000 1.148 --- src/backend/utils/misc/postgresql.conf.sample 1 Jul 2005 13:25:53 -0000 *************** *** 227,233 **** # debug5, debug4, debug3, debug2, debug1, # info, notice, warning, error, panic(off) ! #log_min_duration_statement = -1 # -1 is disabled, in milliseconds. #silent_mode = false # DO NOT USE without syslog or redirect_stderr --- 227,234 ---- # debug5, debug4, debug3, debug2, debug1, # info, notice, warning, error, panic(off) ! #log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements ! # and their durations, in milliseconds. #silent_mode = false # DO NOT USE without syslog or redirect_stderr --ELM1120224733-1456-0_--