Configuration parameter

log_parameter_max_length — PostgreSQL configuration parameter

Category Error Reporting and Logging

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

At a glance

Property Value
Parameter log_parameter_max_length
Category Error Reporting and Logging
Default -1
Value type integer
Change scope Per-session (SET)
Available in PostgreSQL 13, 14, 15, 16, 17, 18, 19 (added in 13)

What it does

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_duration, 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.

(Description quoted from the official PostgreSQL documentation.)

How to apply a change

Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.

Inspect the current value and source with SHOW log_parameter_max_length; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'log_parameter_max_length';.

Tuning guidance

Cap how much of bound parameter values is logged with statements; lower it to avoid dumping large/sensitive values, 0 to omit parameters. Balance debuggability against log size and privacy.

Reference

PostgreSQL documentation — log_parameter_max_length.

Keep going

Related & next steps

Was this helpful?

← All configuration parameters