1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Revert "Add log_statement_sample_rate parameter"

This reverts commit 88bdbd3f74.

As committed, statement sampling used the existing duration threshold
(log_min_duration_statement) when decide which statements to sample.
The issue is that even the longest statements are subject to sampling,
and so may not end up logged. An improvement was proposed, introducing
a second duration threshold, but it would not be backwards compatible.
So we've decided to revert this feature - the separate threshold should
be part of the feature itself.

Discussion: https://postgr.es/m/CAFj8pRDS8tQ3Wviw9%3DAvODyUciPSrGeMhJi_WPE%2BEB8%2B4gLL-Q%40mail.gmail.com
This commit is contained in:
Tomas Vondra
2019-08-04 20:29:00 +02:00
parent d8453ccfbf
commit d5f53a8e26
5 changed files with 13 additions and 65 deletions

View File

@ -5850,13 +5850,12 @@ local0.* /var/log/postgresql
<para>
Causes the duration of each completed statement to be logged
if the statement ran for at least the specified number of
milliseconds, modulated by <varname>log_statement_sample_rate</varname>.
Setting this to zero prints all statement durations.
<literal>-1</literal> (the default) disables logging statements due to
exceeding duration threshold; for example, if you set it to
<literal>250ms</literal>, then all SQL statements that run 250ms or
longer will be logged. Enabling this parameter can be helpful in
tracking down unoptimized queries in your applications.
milliseconds. Setting this to zero prints all statement durations.
Minus-one (the default) disables logging statement durations.
For example, if you set it to <literal>250ms</literal>
then all SQL statements that run 250ms or longer will be
logged. Enabling this parameter can be helpful in tracking down
unoptimized queries in your applications.
Only superusers can change this setting.
</para>
@ -5882,27 +5881,6 @@ local0.* /var/log/postgresql
</listitem>
</varlistentry>
<varlistentry id="guc-log-statement-sample-rate" xreflabel="log_statement_sample_rate">
<term><varname>log_statement_sample_rate</varname> (<type>real</type>)
<indexterm>
<primary><varname>log_statement_sample_rate</varname> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
Determines the fraction of statements that exceed
<xref linkend="guc-log-min-duration-statement"/> to be logged.
The default is <literal>1.0</literal>, meaning log all such
statements.
Setting this to zero disables logging by duration, same as setting
<varname>log_min_duration_statement</varname> to
<literal>-1</literal>.
<varname>log_statement_sample_rate</varname> is helpful when the
traffic is too high to log all queries.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-log-transaction-sample-rate" xreflabel="log_transaction_sample_rate">
<term><varname>log_transaction_sample_rate</varname> (<type>real</type>)
<indexterm>