DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Reporting and Logging / What to Log

debug_print_plan

Logs each query's execution plan.

  • Default: off
  • Type: bool
  • Applies: Session (any user)

In plain words

Writes the complete internal plan that the executor will run, in PostgreSQL's node format. EXPLAIN shows the same plan in readable form; this shows every internal field, which only developers usually need.

For DBAs and operators

Printed as LOG: plan: with a PLANNEDSTMT node (captured with debug_pretty_print = off):

LOG: plan: DETAIL: {PLANNEDSTMT :commandType 1 :queryId 0 :planId 0 :hasReturning false … :planTree {RESULT :plan.disabled_nodes 0 :plan.startup_cost 0 :plan.total_cost 0.01 …

Shows things EXPLAIN hides: plan_node_id, parallel_safe flags, param IDs, relationOids and invalItems used for plan-cache invalidation. Since PostgreSQL 18 nodes carry disabled_nodes (also visible as "Disabled: true" in EXPLAIN). For production investigation prefer auto_explain with log_verbose, which is readable and can be limited by duration.

How to change it

Any user can change it for their session with SET.

See it in context

Life of a query Planner cost model

Related parameters

debug_print_parse debug_print_rewritten debug_pretty_print

All Reporting and Logging parameters