{"Entry":{"collection":"guc","key":"debug_logical_replication_streaming","name":"debug_logical_replication_streaming","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Developer Options","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"15","status":"added","to":"16"}],"content_hash":"518401c8ab032f28e9d6f943b2bd5b248d2c1163849afa124dd8d2242baab27f","context":"","default_changed_in":[],"default_history":[{"from":"16","to":"19","value":"buffered"}],"editorial":{"advice":{"olap":"Long analytical runs can amplify debug_logical_replication_streaming's debug overhead and artifacts. Prefer standard EXPLAIN and statistics first, and isolate any developer experiment from normal users.","oltp":"Do not tune production OLTP with debug_logical_replication_streaming. Enable it only for a bounded reproduction with an owner, log/disk budget, rollback condition, and evidence-capture plan; restore the default immediately afterward.","small":"Keep debug_logical_replication_streaming at its upstream default. A small host has less spare CPU, disk, connection, and log capacity for developer instrumentation."},"mechanism":["debug_logical_replication_streaming forces large-transaction logical replication paths to stream or serialize immediately instead of waiting for normal buffering thresholds. buffered is the production behavior.","On a publisher, immediate streams each change when subscription streaming is enabled or serializes it otherwise, bypassing the logical_decoding_work_mem trigger. On a parallel subscriber, immediate forces file serialization instead of the normal shared-memory queue path.","The two sides therefore exercise different code paths. This is a regression and fault-reproduction control, not a latency or memory tuning shortcut. Its user context permits session- or transaction-local changes; newly performed or newly planned work sees the value."],"pitfalls":["Leaving debug_logical_replication_streaming enabled after the bounded diagnostic or recovery task.","Running the experiment on the only copy of production data.","Underestimating log, core-file, temporary-file, WAL, CPU, or connection-slot amplification.","Treating a server that merely starts or completes a query as proof that data and behavior are correct."],"references":[{"title":"PostgreSQL 19 Beta 4: debug_logical_replication_streaming","url":"https://www.postgresql.org/docs/19/runtime-config-developer.html#GUC-DEBUG-LOGICAL-REPLICATION-STREAMING"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["logical_decoding_work_mem","max_logical_replication_workers","max_sync_workers_per_subscription","wal_level"],"summary":"debug_logical_replication_streaming — Forces immediate streaming or serialization of changes in large transactions. Observed in PG16–19 Beta 4; its last measured boot default is buffered in PG19 Beta 4, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"16","group":"Developer Options","group_slug":"developer","imported_at":"2026-09-27T17:57:31.050781+08:00","intro_commit":{"authored_at":"2023-08-29T15:15:54+02:00","discussion":["https://www.postgresql.org/message-id/flat/d672d774-c44b-6fec-f993-793e744f169a%40eisentraut.org"],"hash":"39d4207e876fa55971cd20a7677b78f067971fd3","subject":"Rename logical_replication_mode to debug_logical_replication_streaming","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=39d4207e876fa55971cd20a7677b78f067971fd3"},"key":"debug_logical_replication_streaming","last_version":"20","max_val":"","min_val":"","name":"debug_logical_replication_streaming","position":88,"present_in":["16","17","18","19","20"],"short_desc":"The allowed values are buffered and immediate.","short_desc_zh":"","source_rev":"english-manuals:6af65a1fd56d2a7de495d3bdab3ba16fc52be1fa25a3e97e9167914462369ca0","unit":"","vartype":"enum"}},"Definition":{"Collection":"guc","Key":"debug_logical_replication_streaming","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"debug_logical_replication_streaming","SourceRevision":"english-manuals:6af65a1fd56d2a7de495d3bdab3ba16fc52be1fa25a3e97e9167914462369ca0","Facts":{"boot_val":"buffered","category":"Developer Options","context":"user","description":"The allowed values are buffered and immediate. The default is buffered. This parameter is intended to be used to test logical decoding and replication of large transactions. The effect of debug_logical_replication_streaming is different for the publisher and subscriber: On the publisher side, debug_logical_replication_streaming allows streaming or serializing changes immediately in logical decoding. When set to immediate, stream each change if the streaming option of CREATE SUBSCRIPTION is enabled, otherwise, serialize each change. When set to buffered, the decoding will stream or serialize changes when logical_decoding_work_mem is reached. On the subscriber side, if the streaming option is set to parallel, debug_logical_replication_streaming can be used to direct the leader apply worker to send changes to the shared memory queue or to serialize all changes to the file. When set to buffered, the leader sends changes to parallel apply workers via a shared memory queue. When set to immediate, the leader serializes all changes to files and notifies the parallel apply workers to read and apply them at the end of the transaction.","doc":{"anchor":"GUC-DEBUG-LOGICAL-REPLICATION-STREAMING","file":"runtime-config-developer.html","lang":"en","sha256":"f5e7e39d176c642ac0799c87669ce2f6f60fcd97d109e290860ec74c36d7ecad","slug":"18"},"documented":true,"enumvals":["buffered","immediate"],"extra_desc":"On the publisher, it allows streaming or serializing each change in logical decoding. On the subscriber, it allows serialization of all changes to files and notifies the parallel apply workers to read and apply them at the end of the transaction.","lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"debug_logical_replication_streaming","short_desc":"Forces immediate streaming or serialization of changes in large transactions.","source":"pg-settings-source-snapshot","unit":null,"vartype":"enum"},"ManualEvidence":{"doc":{"anchor":"GUC-DEBUG-LOGICAL-REPLICATION-STREAMING","file":"runtime-config-developer.html","lang":"en","sha256":"f5e7e39d176c642ac0799c87669ce2f6f60fcd97d109e290860ec74c36d7ecad","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"debug_logical_replication_streaming","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"debug_logical_replication_streaming","Summary":"","BodyHTML":"\u003cp\u003e允许值为\u003ccode\u003ebuffered\u003c/code\u003e和\u003ccode\u003eimmediate\u003c/code\u003e。默认值为\u003ccode\u003ebuffered\u003c/code\u003e。这个参数旨在用于测试逻辑解码以及大型事务的复制。\u003ccode\u003edebug_logical_replication_streaming\u003c/code\u003e对发布者和订阅者的影响不同。\u003c/p\u003e\u003cp\u003e在发布者端，\u003ccode\u003edebug_logical_replication_streaming\u003c/code\u003e允许在逻辑解码中立即流式传输或序列化更改。当设置为\u003ccode\u003eimmediate\u003c/code\u003e时，如果 \u003ca href=\"/docs/18/sql-createsubscription.html#SQL-CREATESUBSCRIPTION-PARAMS-WITH-STREAMING\" rel=\"nofollow\"\u003e\u003ccode\u003estreaming\u003c/code\u003e\u003c/a\u003e选项在 \u003ca href=\"/docs/18/sql-createsubscription.html\" title=\"CREATE SUBSCRIPTION\" rel=\"nofollow\"\u003e\u003ccode\u003eCREATE SUBSCRIPTION\u003c/code\u003e\u003c/a\u003e中已启用，则每条更改都会被流式传输；否则会序列化每条更改。设置为\u003ccode\u003ebuffered\u003c/code\u003e时，会在达到\u003ccode\u003elogical_decoding_work_mem\u003c/code\u003e后再流式传输或序列化更改。\u003c/p\u003e\u003cp\u003e在订阅者端，如果\u003ccode\u003estreaming\u003c/code\u003e选项被设置为\u003ccode\u003eparallel\u003c/code\u003e，则\u003ccode\u003edebug_logical_replication_streaming\u003c/code\u003e可用于控制领导者应用工作进程是将更改发送到共享内存队列，还是将所有更改序列化到文件。设置为\u003ccode\u003ebuffered\u003c/code\u003e时，领导者通过共享内存队列将更改发送给并行应用工作进程。设置为\u003ccode\u003eimmediate\u003c/code\u003e时，领导者会将所有更改序列化到文件，并通知并行应用工作进程在事务结束时读取并应用这些更改。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"1060949b5bb91b5359186057840b1f4bfd7ba71a2615e844e919ab06bc2c9adb","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e允许值为\u003ccode class=\"literal\"\u003ebuffered\u003c/code\u003e和\u003ccode class=\"literal\"\u003eimmediate\u003c/code\u003e。默认值为\u003ccode class=\"literal\"\u003ebuffered\u003c/code\u003e。这个参数旨在用于测试逻辑解码以及大型事务的复制。\u003ccode class=\"varname\"\u003edebug_logical_replication_streaming\u003c/code\u003e对发布者和订阅者的影响不同。\u003c/p\u003e\u003cp\u003e在发布者端，\u003ccode class=\"varname\"\u003edebug_logical_replication_streaming\u003c/code\u003e允许在逻辑解码中立即流式传输或序列化更改。当设置为\u003ccode class=\"literal\"\u003eimmediate\u003c/code\u003e时，如果 \u003ca href=\"/docs/18/sql-createsubscription.html#SQL-CREATESUBSCRIPTION-PARAMS-WITH-STREAMING\"\u003e\u003ccode class=\"literal\"\u003estreaming\u003c/code\u003e\u003c/a\u003e选项在 \u003ca href=\"/docs/18/sql-createsubscription.html\" title=\"CREATE SUBSCRIPTION\"\u003e\u003ccode class=\"command\"\u003eCREATE SUBSCRIPTION\u003c/code\u003e\u003c/a\u003e中已启用，则每条更改都会被流式传输；否则会序列化每条更改。设置为\u003ccode class=\"literal\"\u003ebuffered\u003c/code\u003e时，会在达到\u003ccode class=\"varname\"\u003elogical_decoding_work_mem\u003c/code\u003e后再流式传输或序列化更改。\u003c/p\u003e\u003cp\u003e在订阅者端，如果\u003ccode class=\"literal\"\u003estreaming\u003c/code\u003e选项被设置为\u003ccode class=\"literal\"\u003eparallel\u003c/code\u003e，则\u003ccode class=\"varname\"\u003edebug_logical_replication_streaming\u003c/code\u003e可用于控制领导者应用工作进程是将更改发送到共享内存队列，还是将所有更改序列化到文件。设置为\u003ccode class=\"literal\"\u003ebuffered\u003c/code\u003e时，领导者通过共享内存队列将更改发送给并行应用工作进程。设置为\u003ccode class=\"literal\"\u003eimmediate\u003c/code\u003e时，领导者会将所有更改序列化到文件，并通知并行应用工作进程在事务结束时读取并应用这些更改。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
