Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd1f04b9

Browse files
committed
Tweak docs for log_statement_sample_rate
Author: Justin Pryzby, partly after a suggestion from Masahiko SawadaDiscussion:https://postgr.es/m/20190328135918.GA27808@telsasoft.comDiscussion:https://postgr.es/m/CAD21AoB9+y8N4+Fan-ne-_7J5yTybPttxeVKfwUocKp4zT1vNQ@mail.gmail.com
1 parent799e220 commitd1f04b9

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5821,11 +5821,12 @@ local0.* /var/log/postgresql
58215821
Causes the duration of each completed statement to be logged
58225822
if the statement ran for at least the specified number of
58235823
milliseconds, modulated by <varname>log_statement_sample_rate</varname>.
5824-
Setting this to zero prints all statement durations. Minus-one (the default)
5825-
disables logging statement durations. For example, if you set it to
5826-
<literal>250ms</literal> then all SQL statements that run 250ms or longer
5827-
will be logged. Enabling this parameter can be helpful in tracking down
5828-
unoptimized queries in your applications.
5824+
Setting this to zero prints all statement durations.
5825+
<literal>-1</literal> (the default) disables logging statements due to
5826+
exceeding duration threshold; for example, if you set it to
5827+
<literal>250ms</literal>, then all SQL statements that run 250ms or
5828+
longer will be logged. Enabling this parameter can be helpful in
5829+
tracking down unoptimized queries in your applications.
58295830
Only superusers can change this setting.
58305831
</para>
58315832

@@ -5859,14 +5860,15 @@ local0.* /var/log/postgresql
58595860
</term>
58605861
<listitem>
58615862
<para>
5862-
Determines the fraction ofthestatements that exceed
5863-
<xref linkend="guc-log-min-duration-statement"/>whichtolog.
5864-
The default is <literal>1</literal>, meaning logtoall such
5863+
Determines the fraction of statements that exceed
5864+
<xref linkend="guc-log-min-duration-statement"/> tobe logged.
5865+
The default is <literal>1</literal>, meaning log all such
58655866
statements.
5866-
Setting this to zero disables logging, same as setting
5867-
<varname>log_min_duration_statement</varname>
5868-
to minus-one. <varname>log_statement_sample_rate</varname>
5869-
is helpful when the traffic is too high to log all queries.
5867+
Setting this to zero disables logging by duration, same as setting
5868+
<varname>log_min_duration_statement</varname> to
5869+
<literal>-1</literal>.
5870+
<varname>log_statement_sample_rate</varname> is helpful when the
5871+
traffic is too high to log all queries.
58705872
</para>
58715873
</listitem>
58725874
</varlistentry>
@@ -6144,7 +6146,7 @@ local0.* /var/log/postgresql
61446146

61456147
<note>
61466148
<para>
6147-
The difference betweensetting this option and setting
6149+
The difference betweenenabling <varname>log_duration</varname> and setting
61486150
<xref linkend="guc-log-min-duration-statement"/> to zero is that
61496151
exceeding <varname>log_min_duration_statement</varname> forces the text of
61506152
the query to be logged, but this option doesn't. Thus, if

‎src/backend/utils/misc/guc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3378,8 +3378,8 @@ static struct config_real ConfigureNamesReal[] =
33783378

33793379
{
33803380
{"log_statement_sample_rate",PGC_SUSET,LOGGING_WHEN,
3381-
gettext_noop("Fraction of statementsover log_min_duration_statement tolog."),
3382-
gettext_noop("If you only want a sample, use a value between 0 (never "
3381+
gettext_noop("Fraction of statementsexceeding log_min_duration_statement tobe logged."),
3382+
gettext_noop("If you only want a sample, use a value between 0.0 (never "
33833383
"log) and 1.0 (always log).")
33843384
},
33853385
&log_statement_sample_rate,

‎src/backend/utils/misc/postgresql.conf.sample

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,9 +491,9 @@
491491
# 0 logs all statement, > 0 logs only statements running at
492492
# least this number of milliseconds.
493493

494-
#log_statement_sample_rate = 1# Fraction of logged statementsover
495-
# log_min_duration_statement. 1.0 logs all statements,
496-
# 0 never logs.
494+
#log_statement_sample_rate = 1.0# Fraction of logged statementsexceeding
495+
# log_min_duration_statement to be logged.
496+
#1.0 logs all such statements, 0.0 never logs.
497497

498498
#log_transaction_sample_rate = 0.0# Fraction of transactions whose statements
499499
# are logged regardless of their duration. 1.0 logs all

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp