↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / Configuration Parameters

log_statement_sample_rate

Determines the fraction of statements with duration exceeding log_min_duration_sample that will be logged. Sampling is stochastic, for example 0.5 means there is statistically one chance in two that any given statement will be logged. The default is 1.0, meaning to log all sampled statements. Setting this to zero disables sampled statement-duration logging, the same as setting log_min_duration_sample to -1. Only superusers and users with the appropriate SET privilege can change this setting.

English manual coverage begins with PostgreSQL 7.4. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

boot val
1
category
Reporting and Logging / When to Log
context
superuser
doc same as
Unknown
documented
true
enumvals
Unknown
extra desc
Use a value between 0.0 (never log) and 1.0 (always log).
lang
en
max val
1
metadata version
18
min val
0
name
log_statement_sample_rate
short desc
Fraction of statements exceeding "log_min_duration_sample" to be logged.
source
pg-settings-source-snapshot
unit
Unknown
vartype
real

Definition PG 18

Determines the fraction of statements with duration exceeding log_min_duration_sample that will be logged. Sampling is stochastic, for example 0.5 means there is statistically one chance in two that any given statement will be logged. The default is 1.0, meaning to log all sampled statements. Setting this to zero disables sampled statement-duration logging, the same as setting log_min_duration_sample to -1. Only superusers and users with the appropriate SET privilege can change this setting.

Compare versions

Complete source facts

doc html

<p>
         Determines the fraction of statements with duration exceeding
         <a class="xref" href="/docs/18/runtime-config-logging.html#GUC-LOG-MIN-DURATION-SAMPLE">log_min_duration_sample</a> that will be logged.
         Sampling is stochastic, for example <code class="literal">0.5</code> means
         there is statistically one chance in two that any given statement
         will be logged.
         The default is <code class="literal">1.0</code>, meaning to log all sampled
         statements.
         Setting this to zero disables sampled statement-duration logging,
         the same as setting
         <code class="varname">log_min_duration_sample</code> to
         <code class="literal">-1</code>.
         Only superusers and users with the appropriate <code class="literal">SET</code>
         privilege can change this setting.
        </p>

documentation revision

{"inputs":[{"file":"runtime-config-logging.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"278d913b9c0f735c5cd7b35fd7205826bbd9c449805370d2dbe54105c0ed1d88","version":"18.7"},{"file":"runtime-config-logging.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"68c010254e1859ec0b76f06a563babd51a6c38997f1242e35e4c6b649724b1cb","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · wiki-repair-20261023:3eef877a5ad08b4144098a055820d58ae3ab19851588a799173533d47a9e57cd

Text language: en · wiki-repair-20261023:3eef877a5ad08b4144098a055820d58ae3ab19851588a799173533d47a9e57cd