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
[email protected] | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
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 ****
</indexterm>
<listitem>
<para>
! 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
! <literal>250</literal> 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.
</para>
</listitem>
</varlistentry>
--- 2628,2644 ----
</indexterm>
<listitem>
<para>
! 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 <literal>250</literal>
! 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 <varname>log_statement</varname> and
! <varname>log_duration</varname>. Only superusers can change
! this setting.
</para>
</listitem>
</varlistentry>
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
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster