Skip to content

log_parameter_max_length

log_parameter_max_length is the PostgreSQL setting that defines the maximum length in bytes of data logged for bind parameter values when logging statements.
Note

Fact — official short description: “Sets the maximum length in bytes of data logged for bind parameter values when logging statements.”

Identity

Type , Valueinteger
Upstream pg_settings type
Context , Valuesuperuser
Settable at runtime by a superuser
Unit , ValueB
Raw unit
Range , Value-11073741823
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueReporting and Logging / What to Log
Upstream classification
Latest boot value , Value-1
-1 B

Lifecycle

Fact Value
First observed PG13
Present in PG13–19 Beta 3
Removed in No
Introduction commit 0b34e7d307e6 — Improve user control over truncation of logged bind-parameter values.
Commit date 2020-04-02
Discussion thread 1

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG13–19 Beta 3 -1 B -1 B

How it works

log_parameter_max_length controls Bind values attached to non-error statement-logging messages. Zero suppresses them, -1 allows full values, and a positive byte count truncates each textual value to that limit.

It applies to messages produced by log_statement, log_min_duration_statement, and related statement-logging settings. Any nonzero value adds work; parameters sent in binary form must be converted to text before they can be logged.

It is a SUPERUSER-context session setting and is independent of log_parameter_max_length_on_error. The normal and error paths therefore need separate confidentiality and overhead decisions.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
OLTP Keep zero when Bind values may contain credentials or regulated data. If diagnostics require values, choose the smallest useful positive limit and measure binary-bind conversion cost under peak OLTP traffic.
OLAP Analytical parameters can be large arrays or predicates; use a bounded positive limit for a short diagnostic window rather than -1, and verify logs remain useful after truncation.
Small nodes Use zero by default. Full values consume disk and conversion CPU that a small node cannot absorb safely, and truncation is not redaction.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP Unmodified
OLAP Unmodified
CRIT Unmodified
TINY Unmodified
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG13–19 Beta 3 unmodified; OLAP: PG13–19 Beta 3 unmodified; CRIT: PG13–19 Beta 3 unmodified; TINY: PG13–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • Using -1 and exposing complete credentials, tokens, or large payloads in normal statement logs.
  • Treating truncation as redaction; a sensitive prefix can remain fully visible.
  • Ignoring text-conversion overhead for binary Bind parameters when the value is nonzero.
  • Assuming this setting also limits error-path parameters controlled by log_parameter_max_length_on_error.

log_statement · log_duration · log_connections · log_disconnections · log_parameter_max_length_on_error

References