Wiki / Configuration Parameters
log_transaction_sample_rate
Sets the fraction of transactions whose statements are all logged, in addition to statements logged for other reasons. It applies to each new transaction regardless of its statements' durations. Sampling is stochastic, for example 0.1 means there is statistically one chance in ten that any given transaction will be logged. log_transaction_sample_rate can be helpful to construct a sample of transactions. The default is 0, meaning not to log statements from any additional transactions. Setting this to 1 logs all statements of all transactions. Only superusers and users with the appropriate SET privilege can change this setting. Note Like all statement-logging options, this option can add significant overhead.
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
- 0
- 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 (log all statements for all transactions).
- lang
- en
- max val
- 1
- metadata version
- 18
- min val
- 0
- name
- log_transaction_sample_rate
- short desc
- Sets the fraction of transactions from which to log all statements.
- source
- pg-settings-source-snapshot
- unit
- Unknown
- vartype
- real
Definition PG 18
Sets the fraction of transactions whose statements are all logged,
in addition to statements logged for other reasons. It applies to
each new transaction regardless of its statements' durations.
Sampling is stochastic, for example 0.1 means
there is statistically one chance in ten that any given transaction
will be logged.
log_transaction_sample_rate can be helpful to
construct a sample of transactions.
The default is 0, meaning not to log
statements from any additional transactions. Setting this
to 1 logs all statements of all transactions.
Only superusers and users with the appropriate SET
privilege can change this setting.
Note
Like all statement-logging options, this option can add significant overhead.
Compare versions
Complete source facts
doc html
<p>
Sets the fraction of transactions whose statements are all logged,
in addition to statements logged for other reasons. It applies to
each new transaction regardless of its statements' durations.
Sampling is stochastic, for example <code class="literal">0.1</code> means
there is statistically one chance in ten that any given transaction
will be logged.
<code class="varname">log_transaction_sample_rate</code> can be helpful to
construct a sample of transactions.
The default is <code class="literal">0</code>, meaning not to log
statements from any additional transactions. Setting this
to <code class="literal">1</code> logs all statements of all transactions.
Only superusers and users with the appropriate <code class="literal">SET</code>
privilege can change this setting.
</p><div class="note"><h3 class="title">Note</h3><p>
Like all statement-logging options, this option can add significant
overhead.
</p></div>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:549803b3a0fea80920b24dee7ae43433c9093cb5270bea1aa182eab5d5b4c3c2
Text language: en · wiki-repair-20261023:549803b3a0fea80920b24dee7ae43433c9093cb5270bea1aa182eab5d5b4c3c2