DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Reporting and Logging / What to Log

log_parameter_max_length

Sets the maximum length in bytes of data logged for bind parameter values when logging statements. -1 means log values in full.

  • Default: -1
  • Type: integer (B)
  • Range: -1 … 1024MB
  • Applies: Session (superuser)

In plain words

When statements from an application are logged (slow queries, log_statement), the values passed as parameters are logged too. This setting limits how many bytes of each value are printed; long values get ... at the end. 0 stops printing them.

For DBAs and operators

Applies to the DETAIL: Parameters: … lines added to statement and duration logging for extended-protocol statements (PostgreSQL 13+). Real output with log_parameter_max_length = 10:

LOG: duration: 0.107 ms bind <unnamed>: select $1::text, $2::int DETAIL: Parameters: $1 = 'abcdefghij...', $2 = '42'

With -1 (default) values are printed in full, which can mean megabytes for bytea or JSON parameters, plus privacy exposure (passwords, personal data). 0 removes the Parameters line entirely. A cap such as 64–1024 bytes is a good compromise. Truncation respects multibyte character boundaries.

Error reports are governed separately by log_parameter_max_length_on_error. Literal values written directly in SQL text are not affected by either setting.

How to change it

A superuser (or a role granted SET) can change it per session with SET.

See it in context

Wire protocol Logger (logging collector)

Related parameters

log_parameter_max_length_on_error log_min_duration_statement log_statement

All Reporting and Logging parameters