{"Entry":{"collection":"guc","key":"debug_print_plan","name":"debug_print_plan","aliases":[],"metadata":{"baseline":true,"boot_human":"Not specified","boot_val":null,"category":"Reporting and Logging / What to Log","category_zh":"","changed_in":[],"changes":[{"documentation_changed":true,"fields":{},"from":"7.4","status":"changed","to":"8.0"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"},{"documentation_changed":true,"fields":{},"from":"8.3","status":"changed","to":"8.4"},{"documentation_changed":true,"fields":{},"from":"18","status":"changed","to":"19"}],"content_hash":"ca5ae2aa1d3f303578fd6a18a9a65be7c7ff2ea08cdbc3c4bab91b94699ec1a5","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"off"}],"editorial":{"advice":{"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."},"mechanism":["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."],"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."],"references":[{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["debug_pretty_print","debug_print_parse","debug_print_rewritten","log_min_messages","client_min_messages"],"summary":"debug_print_plan is the PostgreSQL setting that controls whether PostgreSQL logs each query's execution plan."},"enumvals":[],"first_version":"7.4","group":"Reporting and Logging","group_slug":"logging","imported_at":"2026-09-30T00:40:56.927863+08:00","intro_commit":{},"key":"debug_print_plan","last_version":"20","max_val":"","min_val":"","name":"debug_print_plan","position":92,"present_in":["7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"These parameters enable various debugging output to be emitted.","short_desc_zh":"","source_rev":"english-manuals:af96fe2570dbb63b6e1a09b0d6537a3539415c7b6a6f097f2c6edfd0cb0bd5f4","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"debug_print_plan","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"debug_print_plan","SourceRevision":"english-manuals:af96fe2570dbb63b6e1a09b0d6537a3539415c7b6a6f097f2c6edfd0cb0bd5f4","Facts":{"boot_val":"off","category":"Reporting and Logging / What to Log","context":"user","description":"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.","doc":{"anchor":"GUC-DEBUG-PRINT-PARSE","file":"runtime-config-logging.html","lang":"en","sha256":"93c48c522a72fca19705c4c91a71e951eae653662008eee2e4a9a74a11127fde","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"debug_print_plan","short_desc":"Logs each query's execution plan.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-DEBUG-PRINT-PARSE","file":"runtime-config-logging.html","lang":"en","sha256":"93c48c522a72fca19705c4c91a71e951eae653662008eee2e4a9a74a11127fde","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"debug_print_plan","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"debug_print_plan","Summary":"","BodyHTML":"\u003cp\u003e这些参数将会让多种调试输出被发出。当被设置时，它们为每一个被执行的查询打印结果分析树、查询重写器输出或执行计划。这些消息在\u003ccode\u003eLOG\u003c/code\u003e消息级别上被发出，因此默认情况下它们将出现在服务器日志中但不会被发送到客户端。你可以通过调整\u003ca href=\"/docs/18/runtime-config-client.html#GUC-CLIENT-MIN-MESSAGES\" rel=\"nofollow\"\u003eclient_min_messages\u003c/a\u003e和/或\u003ca href=\"/docs/18/runtime-config-logging.html#GUC-LOG-MIN-MESSAGES\" rel=\"nofollow\"\u003elog_min_messages\u003c/a\u003e来改变这种情况。这些参数默认是关闭的。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"d746479b547060e1841cb2cacd1111499536c4d637c61fc8cd3f6bc115b4270c","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e这些参数将会让多种调试输出被发出。当被设置时，它们为每一个被执行的查询打印结果分析树、查询重写器输出或执行计划。这些消息在\u003ccode class=\"literal\"\u003eLOG\u003c/code\u003e消息级别上被发出，因此默认情况下它们将出现在服务器日志中但不会被发送到客户端。你可以通过调整\u003ca href=\"/docs/18/runtime-config-client.html#GUC-CLIENT-MIN-MESSAGES\"\u003eclient_min_messages\u003c/a\u003e和/或\u003ca href=\"/docs/18/runtime-config-logging.html#GUC-LOG-MIN-MESSAGES\"\u003elog_min_messages\u003c/a\u003e来改变这种情况。这些参数默认是关闭的。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
