select open change scope Open full search

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

CONFIGURATION / REPORTING AND LOGGING

log_parameter_max_length

Read PG 18 manual ↗

If greater than zero, each bind parameter value logged with a non-error statement-logging message is trimmed to this many bytes.

Type
integer
Context
superuser
Measured default
-1 B
Unit
B
Metadata snapshot
18

Definition PG 18 manual

If greater than zero, each bind parameter value logged with a non-error statement-logging message is trimmed to this many bytes. Zero disables logging of bind parameters for non-error statement logs. -1 (the default) allows bind parameters to be logged in full. If this value is specified without units, it is taken as bytes. Only superusers and users with the appropriate SET privilege can change this setting.

This setting only affects log messages printed as a result of log_statement, log_min_duration_statement, and related settings. Non-zero values of this setting add some overhead, particularly if parameters are sent in binary form, since then conversion to text is required.

Measured default history
Version intervalDefault
13 – 19-1 B
Analysis & operational context

Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗

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.

Operational considerations

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.

Workload guidance

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.

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.

SMALL: Use zero by default. Full values consume disk and conversion CPU that a small node cannot absorb safely, and truncation is not redaction.

Version history 4
  1. PG 17 → 18changed
  2. PG 14 → 15changed
  3. PG 13 → 14changed
  4. PG 12 → 13added

Related entries

Further reading

Definition snapshot: english-manuals:fd9943879b7a3086d78a8c7baeb… · English manual source