Skip to content

log_min_error_statement

log_min_error_statement is the PostgreSQL setting that causes all statements generating error at or above this level to be logged.
Note

Fact — official short description: “Causes all statements generating error at or above this level to be logged.”

Identity

Type , Valueenum
Upstream pg_settings type
Context , Valuesuperuser
Settable at runtime by a superuser
Unit , Value
Raw unit
Range , Value
Raw limits in the last observed version
Enum values , Valuedebug5, debug4, debug3, debug2, debug1, info, notice, warning, error, log, fatal, panic
— for non-enum types
Category , ValueReporting and Logging / When to Log
Upstream classification
Latest boot value , Valueerror
error

Lifecycle

Fact Value
First observed PG9.0 (research boundary)
Present in PG9.0–19 Beta 3
Removed in No
Introduction commit Not asserted: predates the PG9.0 research boundary
Commit date
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.0–19 Beta 3 error error

How it works

log_min_error_statement causes all statements generating error at or above this level to be logged. Each level includes all the levels that follow it. The later the level, the fewer messages are sent. It governs whether the SQL statement associated with an error-level message is included; log_min_messages separately decides whether the message itself is emitted.

log_min_error_statement is a SUPERUSER-context setting. Superuser or a role granted the appropriate SET privilege can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.

It changes emitted diagnostic data rather than query semantics, but volume, sensitive content, log_line_prefix, destinations, collector throughput, and retention determine operational cost and usefulness.

Tuning advice

Tip

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

Workload Guidance
OLTP Tune log_min_error_statement against an explicit observability question and a measured log-volume budget. Prefer selective thresholds, sampling, or role-level overrides over indiscriminate capture.
OLAP Analytical jobs can justify richer log_min_error_statement telemetry, but account for long statements, large bind values, and bursty completion patterns in the log pipeline.
Small nodes Keep log_min_error_statement useful but bounded: verify disk, collector, retention, and redaction capacity before increasing detail or frequency.

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: PG9.0–19 Beta 3 unmodified; OLAP: PG9.0–19 Beta 3 unmodified; CRIT: PG9.0–19 Beta 3 unmodified; TINY: PG9.0–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • Changing log_min_error_statement in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.
  • Enabling richer logging without budgeting collector throughput, storage, retention, and downstream query cost.
  • Writing SQL text, bind values, identities, or host data without a redaction and access-control policy.
  • Changing log_min_error_statement globally without a rollback plan and a client or operational compatibility test.

log_min_messages · log_min_duration_statement · log_min_duration_sample · log_statement_sample_rate · log_transaction_sample_rate

References