# 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 {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `integer` | Upstream pg_settings type |
| Context | `superuser` | Settable at runtime by a superuser |
| Unit | `B` | Raw unit |
| Range | `-1` – `1073741823` | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Reporting and Logging / What to Log | Upstream classification |
| Latest boot value | `-1` | -1 B |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG13 |
| Present in | PG13–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`0b34e7d307e6`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=0b34e7d307e6a142ee94800e6d5f3e73449eeffd) — Improve user control over truncation of logged bind-parameter values. |
| Commit date | 2020-04-02 |
| Discussion | [thread 1](https://postgr.es/m/b10493cc-a399-a03a-67c7-068f2791ee50@imap.cc) |

## Default history {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG13–19 Beta 3 | `-1` | `B` | -1 B |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

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 {#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. |
{.full-width}

## Pigsty {#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 | — | — |
{.full-width}

> [!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 {#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.

## Related parameters {#related-parameters}

[`log_statement`](/parameters/log-statement/) · [`log_duration`](/parameters/log-duration/) · [`log_connections`](/parameters/log-connections/) · [`log_disconnections`](/parameters/log-disconnections/) · [`log_parameter_max_length_on_error`](/parameters/log-parameter-max-length-on-error/)

## References {#references}

- [PostgreSQL 19 Beta 3 — log_parameter_max_length](https://www.postgresql.org/docs/19/runtime-config-logging.html#GUC-LOG-PARAMETER-MAX-LENGTH)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
