debug_print_plan
Read PG 18 manual ↗These parameters enable various debugging output to be emitted.
- Type
- bool
- Context
- user
- Measured default
- off
- Unit
- —
- Metadata snapshot
- 18
Definition PG 18 manual
These parameters enable various debugging output to be emitted. When set, they print the resulting parse tree, the query rewriter output, or the execution plan for each executed query. These messages are emitted at LOG message level, so by default they will appear in the server log but will not be sent to the client. You can change that by adjusting client_min_messages and/or log_min_messages. These parameters are off by default.
Measured default history
| Version interval | Default |
|---|---|
| 9.0 – 19 | off |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗
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.
Operational considerations
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.
Workload guidance
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.
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.
SMALL: Leave debug_print_plan at its normal default. Verbose internal trees can exhaust a small node's log I/O and disk unexpectedly.
Version history 1
- PG 18 → 19changed
Related entries
Further reading
Definition snapshot: english-manuals:972eee08bb82b8ebc5aac30fda5… · English manual source