{"Entry":{"collection":"guc","key":"debug_print_rewritten","name":"debug_print_rewritten","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":"bc21c2cfde4e8fd1bd2ad06409cd2146d6cfe26bce614c39f4960ff5d66177a8","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"off"}],"editorial":{"advice":{"olap":"Do not use debug_print_rewritten 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_rewritten 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_rewritten at its normal default. Verbose internal trees can exhaust a small node's log I/O and disk unexpectedly."},"mechanism":["debug_print_rewritten logs each query's rewritten parse tree. It exposes the query tree after rule rewriting, which is useful for diagnosing views and rules but can generate very large logs.","debug_print_rewritten 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_rewritten 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_rewritten 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_plan","log_min_messages","client_min_messages"],"summary":"debug_print_rewritten is the PostgreSQL setting that controls whether PostgreSQL logs each query's rewritten parse tree."},"enumvals":[],"first_version":"7.4","group":"Reporting and Logging","group_slug":"logging","imported_at":"2026-09-30T00:40:56.944048+08:00","intro_commit":{},"key":"debug_print_rewritten","last_version":"20","max_val":"","min_val":"","name":"debug_print_rewritten","position":94,"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:6f79131ecc6dbc504396c099039f2304ba599c87c483ebb3103e86b8042f74d8","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"debug_print_rewritten","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"debug_print_rewritten","SourceRevision":"english-manuals:6f79131ecc6dbc504396c099039f2304ba599c87c483ebb3103e86b8042f74d8","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_rewritten","short_desc":"Logs each query's rewritten parse tree.","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_rewritten","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"debug_print_rewritten","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":"bd2f424e24d791a73c989c76fc4e91b984fa4f12df73de9f5151cc75507e1e6a","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}
