@@ -5984,13 +5984,13 @@ local0.* /var/log/postgresql
5984
5984
<para>
5985
5985
Causes the duration of each completed statement to be logged
5986
5986
if the statement ran for at least the specified amount of time.
5987
- If this value is specified without units, it is taken as milliseconds.
5988
- Setting this to zero prints all statement durations.
5989
- Minus-one (the default) disables logging statement durations.
5990
5987
For example, if you set it to <literal>250ms</literal>
5991
5988
then all SQL statements that run 250ms or longer will be
5992
5989
logged. Enabling this parameter can be helpful in tracking down
5993
5990
unoptimized queries in your applications.
5991
+ If this value is specified without units, it is taken as milliseconds.
5992
+ Setting this to zero prints all statement durations.
5993
+ Minus-one (the default) disables logging statement durations.
5994
5994
Only superusers can change this setting.
5995
5995
</para>
5996
5996
@@ -6030,93 +6030,80 @@ local0.* /var/log/postgresql
6030
6030
</term>
6031
6031
<listitem>
6032
6032
<para>
6033
- Allows to sample the logging of the duration of each completed
6034
- statement if the statement ran for at least the specified amount of
6035
- time. If this value is specified without units, it is taken as milliseconds.
6033
+ Allows sampling the duration of completed statements that ran for
6034
+ at least the specified amount of time. This produces the same
6035
+ kind of log entries as
6036
+ <xref linkend="guc-log-min-duration-statement"/>, but only for a
6037
+ subset of the executed statements, with sample rate controlled by
6038
+ <xref linkend="guc-log-statement-sample-rate"/>.
6039
+ For example, if you set it to <literal>100ms</literal> then all
6040
+ SQL statements that run 100ms or longer will be considered for
6041
+ sampling. Enabling this parameter can be helpful when the
6042
+ traffic is too high to log all queries.
6043
+ If this value is specified without units, it is taken as milliseconds.
6036
6044
Setting this to zero samples all statement durations.
6037
6045
Minus-one (the default) disables sampling statement durations.
6038
- For example, if you set it to <literal>250ms</literal>
6039
- then all SQL statements that run 250ms or longer will be considered
6040
- for sampling, with sample rate is controlled by <xref linkend="guc-log-statement-sample-rate"/>.
6041
- Enabling this parameter can be helpful when the traffic too high to
6042
- sample all queries.
6043
6046
Only superusers can change this setting.
6044
6047
</para>
6045
6048
6046
6049
<para>
6047
- This option has lower priority than <xref linkend="guc-log-min-duration-statement"/>,
6048
- meaning that statements with durations exceeding <xref linkend="guc-log-min-duration-statement"/>
6049
- are not subject to sampling and are always logged.
6050
- </para>
6051
-
6052
- <para>
6053
- For clients using extended query protocol, durations of the Parse,
6054
- Bind, and Execute steps are logged independently.
6050
+ This setting has lower priority
6051
+ than <varname>log_min_duration_statement</varname>, meaning that
6052
+ statements with durations
6053
+ exceeding <varname>log_min_duration_statement</varname> are not
6054
+ subject to sampling and are always logged.
6055
6055
</para>
6056
6056
6057
- <note>
6058
6057
<para>
6059
- When using this option together with
6060
- <xref linkend="guc-log-statement"/>,
6061
- the text of statements that are logged because of
6062
- <varname>log_statement</varname> will not be repeated in the
6063
- duration log message.
6064
- If you are not using <application>syslog</application>, it is recommended
6065
- that you log the PID or session ID using
6066
- <xref linkend="guc-log-line-prefix"/>
6067
- so that you can link the statement message to the later
6068
- duration message using the process ID or session ID.
6058
+ Other notes for <varname>log_min_duration_statement</varname>
6059
+ apply also to this setting.
6069
6060
</para>
6070
- </note>
6071
6061
</listitem>
6072
6062
</varlistentry>
6073
6063
6074
6064
<varlistentry id="guc-log-statement-sample-rate" xreflabel="log_statement_sample_rate">
6075
- <term><varname>log_statement_sample_rate</varname> (<type>real </type>)
6065
+ <term><varname>log_statement_sample_rate</varname> (<type>floating point </type>)
6076
6066
<indexterm>
6077
6067
<primary><varname>log_statement_sample_rate</varname> configuration parameter</primary>
6078
6068
</indexterm>
6079
6069
</term>
6080
6070
<listitem>
6081
6071
<para>
6082
6072
Determines the fraction of statements with duration exceeding
6083
- <xref linkend="guc-log-min-duration-sample"/> to be logged.
6084
- This is a statistical parameter, for example <literal>0.5</literal>
6085
- means there is statistically one in two chances to log the statement.
6086
- The default is <literal>1.0</literal>, meaning log all such
6073
+ <xref linkend="guc-log-min-duration-sample"/> that will be logged.
6074
+ Sampling is stochastic, for example <literal>0.5</literal> means
6075
+ there is statistically one chance in two that any given statement
6076
+ will be logged.
6077
+ The default is <literal>1.0</literal>, meaning to log all sampled
6087
6078
statements.
6088
- Setting this to zero disables sampling logging, same as setting
6079
+ Setting this to zero disables sampled statement-duration logging,
6080
+ the same as setting
6089
6081
<varname>log_min_duration_sample</varname> to
6090
6082
<literal>-1</literal>.
6091
- <varname>log_statement_sample_rate</varname> is helpful when the
6092
- traffic is too high to log all queries.
6093
6083
Only superusers can change this setting.
6094
6084
</para>
6095
- <note>
6096
- <para>
6097
- Like all statement-logging options, this option can add significant
6098
- overhead.
6099
- </para>
6100
- </note>
6101
6085
</listitem>
6102
6086
</varlistentry>
6103
6087
6104
6088
<varlistentry id="guc-log-transaction-sample-rate" xreflabel="log_transaction_sample_rate">
6105
- <term><varname>log_transaction_sample_rate</varname> (<type>real </type>)
6089
+ <term><varname>log_transaction_sample_rate</varname> (<type>floating point </type>)
6106
6090
<indexterm>
6107
6091
<primary><varname>log_transaction_sample_rate</varname> configuration parameter</primary>
6108
6092
</indexterm>
6109
6093
</term>
6110
6094
<listitem>
6111
6095
<para>
6112
- Set the fraction of transactions whose statements are all logged,
6096
+ Sets the fraction of transactions whose statements are all logged,
6113
6097
in addition to statements logged for other reasons. It applies to
6114
6098
each new transaction regardless of its statements' durations.
6115
- The default is <literal>0</literal>, meaning not to log statements
6116
- from any additional transaction. Setting this to <literal>1</literal>
6117
- logs all statements for all transactions.
6118
- <varname>log_transaction_sample_rate</varname> is helpful to track a
6119
- sample of transaction.
6099
+ Sampling is stochastic, for example <literal>0.1</literal> means
6100
+ there is statistically one chance in ten that any given transaction
6101
+ will be logged.
6102
+ <varname>log_transaction_sample_rate</varname> can be helpful to
6103
+ construct a sample of transactions.
6104
+ The default is <literal>0</literal>, meaning not to log
6105
+ statements from any additional transactions. Setting this
6106
+ to <literal>1</literal> logs all statements of all transactions.
6120
6107
Only superusers can change this setting.
6121
6108
</para>
6122
6109
<note>
@@ -6632,9 +6619,9 @@ log_line_prefix = '%m [%p] %q%u@%d/%a '
6632
6619
<para>
6633
6620
Controls whether bind parameters are logged when a statement is logged
6634
6621
as a result of <xref linkend="guc-log-min-error-statement"/>.
6635
- It adds some overhead, as postgres will compute and store textual
6636
- representations of parameter values in memory for all statements,
6637
- even if they eventually do not get logged.
6622
+ It adds some overhead, as <productname>PostgreSQL</productname> will
6623
+ compute and store textual representations of parameter values in
6624
+ memory for all statements, even if they eventually do not get logged.
6638
6625
This setting has no effect on statements logged due to
6639
6626
<xref linkend="guc-log-min-duration-statement"/> or
6640
6627
<xref linkend="guc-log-statement"/> settings, as they are always logged
0 commit comments