Skip to content

debug_print_plan

debug_print_plan is the PostgreSQL setting that controls whether PostgreSQL logs each query’s execution plan.
Note

Fact — official short description: “Logs each query’s execution plan.”

Identity

Type , Valuebool
Upstream pg_settings type
Context , Valueuser
Settable by an ordinary user
Unit , Value—
Raw unit
Range , Value—
Raw limits in the last observed version
Enum values , Value—
— for non-enum types
Category , ValueReporting and Logging / What to Log
Upstream classification
Latest boot value , Valueoff
off

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 off — off

How it works

debug_print_plan logs each query’s execution plan. The output is an internal plan tree for every query and is much more verbose than a targeted EXPLAIN; it is intended for server debugging.

debug_print_plan is a USER-context setting. An authorized role can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.

The debug_print_* switches feed the normal server logging path, so log_min_messages, log_destination, and collector capacity determine whether the output is retained safely.

Tuning advice

Tip

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

Workload Guidance
OLTP Do not tune or enable debug_print_plan globally in production. If server-developer diagnostics require it, isolate one session, bound its duration, and route the resulting logs safely.
OLAP Do not use debug_print_plan as a substitute for EXPLAIN on analytical SQL; capture a targeted plan instead of dumping every internal tree.
Small nodes Leave debug_print_plan at its normal default. Verbose internal trees can exhaust a small node’s log I/O and disk unexpectedly.

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 debug_print_plan in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.
  • Leaving an internal-tree dump enabled globally and overwhelming log I/O, storage, or ingestion.
  • Treating debug output as a stable public format or as a substitute for targeted EXPLAIN diagnostics.
  • Changing debug_print_plan globally without a rollback plan and a client or operational compatibility test.

debug_pretty_print · debug_print_parse · debug_print_rewritten · log_min_messages · client_min_messages

References