Parameter · Reporting and Logging / What to Log
debug_print_parse
Logs each query's parse tree.
- Default:
off - Type: bool
- Applies: Session (any user)
In plain words
Writes PostgreSQL's internal representation of each query, right after parsing, into the log. It is meant for people working on PostgreSQL itself or on extensions, not for everyday tuning.
For DBAs and operators
Printed at LOG level as LOG: parse tree: followed by a DETAIL with the Query node (after parse analysis, before rewriting). Captured on 18.6:
Output is enormous (dozens of lines per trivial statement, thousands for views or ORMs), so only enable it in a session: SET debug_print_parse = on (any user can, since it only affects their own session). To see the output in psql as well, SET client_min_messages = log.
Formatting follows debug_pretty_print. The three stages are parse (this), rewritten (views and rules expanded) and plan.
How to change it
Any user can change it for their session with SET.
See it in context
Related parameters
debug_print_rewritten debug_print_plan debug_pretty_print client_min_messages