{"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"}],"derived_content_hash":"4bcfa24910f41c7b4a4dfe5394ea5dc4eff68a22c31b9b5fa344df41483b8511","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:352549c9bd01b31620d5c59da6dc8ce9544c6dc56bf3b77b5f5fec90b3b23262","versions":{"16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"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"],"repair_provenance":{"original_source_revision":"english-manuals:6af65a1fd56d2a7de495d3bdab3ba16fc52be1fa25a3e97e9167914462369ca0","receipt_sha256":"6eba8a50d31637ae520f27d6b68eaa185398096246db00a47c766a95c351e186","repair":"wiki-repair-20261023"},"short_desc":"The allowed values are buffered and immediate.","short_desc_zh":"","source_rev":"wiki-repair-20261023:352549c9bd01b31620d5c59da6dc8ce9544c6dc56bf3b77b5f5fec90b3b23262","unit":"","vartype":"enum"}},"Definition":{"Collection":"guc","Key":"debug_logical_replication_streaming","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"debug_logical_replication_streaming","SourceRevision":"wiki-repair-20261023:352549c9bd01b31620d5c59da6dc8ce9544c6dc56bf3b77b5f5fec90b3b23262","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.","description_zh":"允许值为 buffered 和 immediate。默认值为 buffered。这个参数旨在用于测试逻辑解码以及大型事务的复制。debug_logical_replication_streaming 对发布者和订阅者的影响不同。 在发布者端，debug_logical_replication_streaming 允许在逻辑解码中立即流式传输或序列化更改。当设置为 immediate 时，如果 streaming 选项在 CREATE SUBSCRIPTION 中已启用，则每条更改都会被流式传输；否则会序列化每条更改。设置为 buffered 时，会在达到 logical_decoding_work_mem 后再流式传输或序列化更改。 在订阅者端，如果 streaming 选项被设置为 parallel，则 debug_logical_replication_streaming 可用于控制领导者应用工作进程是将更改发送到共享内存队列，还是将所有更改序列化到文件。设置为 buffered 时，领导者通过共享内存队列将更改发送给并行应用工作进程。设置为 immediate 时，领导者会将所有更改序列化到文件，并通知并行应用工作进程在事务结束时读取并应用这些更改。","description_zh_html":"\u003cp\u003e\n        允许值为 \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 对发布者和订阅者的影响不同。\n       \u003c/p\u003e\u003cp\u003e\n        在发布者端，\u003ccode class=\"varname\"\u003edebug_logical_replication_streaming\u003c/code\u003e 允许在逻辑解码中立即流式传输或序列化更改。当设置为 \u003ccode class=\"literal\"\u003eimmediate\u003c/code\u003e 时，如果\n        \u003ca class=\"link\" href=\"/zh/docs/18/sql-createsubscription.html#SQL-CREATESUBSCRIPTION-PARAMS-WITH-STREAMING\"\u003e\u003ccode class=\"literal\"\u003estreaming\u003c/code\u003e\u003c/a\u003e 选项在\n        \u003ca class=\"link\" href=\"/zh/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 后再流式传输或序列化更改。\n       \u003c/p\u003e\u003cp\u003e\n        在订阅者端，如果 \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 时，领导者会将所有更改序列化到文件，并通知并行应用工作进程在事务结束时读取并应用这些更改。\n       \u003c/p\u003e","doc":{"anchor":"GUC-DEBUG-LOGICAL-REPLICATION-STREAMING","file":"runtime-config-developer.html","lang":"en","sha256":"a3f6a107ed6ba4edaf6df03e52f4a469bd09350d545e4ff419e62844025ec1cf","slug":"18"},"doc_html":"\u003cp\u003e\n        The allowed values are \u003ccode class=\"literal\"\u003ebuffered\u003c/code\u003e and\n        \u003ccode class=\"literal\"\u003eimmediate\u003c/code\u003e. The default is \u003ccode class=\"literal\"\u003ebuffered\u003c/code\u003e.\n        This parameter is intended to be used to test logical decoding and\n        replication of large transactions.  The effect of\n        \u003ccode class=\"varname\"\u003edebug_logical_replication_streaming\u003c/code\u003e is different for the\n        publisher and subscriber:\n       \u003c/p\u003e\u003cp\u003e\n        On the publisher side, \u003ccode class=\"varname\"\u003edebug_logical_replication_streaming\u003c/code\u003e\n        allows streaming or serializing changes immediately in logical decoding.\n        When set to \u003ccode class=\"literal\"\u003eimmediate\u003c/code\u003e, stream each change if the\n        \u003ca class=\"link\" href=\"/docs/18/sql-createsubscription.html#SQL-CREATESUBSCRIPTION-PARAMS-WITH-STREAMING\"\u003e\u003ccode class=\"literal\"\u003estreaming\u003c/code\u003e\u003c/a\u003e\n        option of\n        \u003ca class=\"link\" href=\"/docs/18/sql-createsubscription.html\" title=\"CREATE SUBSCRIPTION\"\u003e\u003ccode class=\"command\"\u003eCREATE SUBSCRIPTION\u003c/code\u003e\u003c/a\u003e\n        is enabled, otherwise, serialize each change.  When set to\n        \u003ccode class=\"literal\"\u003ebuffered\u003c/code\u003e, the decoding will stream or serialize\n        changes when \u003ccode class=\"varname\"\u003elogical_decoding_work_mem\u003c/code\u003e is reached.\n       \u003c/p\u003e\u003cp\u003e\n        On the subscriber side, if the \u003ccode class=\"literal\"\u003estreaming\u003c/code\u003e option is set to\n        \u003ccode class=\"literal\"\u003eparallel\u003c/code\u003e, \u003ccode class=\"varname\"\u003edebug_logical_replication_streaming\u003c/code\u003e\n        can be used to direct the leader apply worker to send changes to the\n        shared memory queue or to serialize all changes to the file.  When set to\n        \u003ccode class=\"literal\"\u003ebuffered\u003c/code\u003e, the leader sends changes to parallel apply\n        workers via a shared memory queue.  When set to\n        \u003ccode class=\"literal\"\u003eimmediate\u003c/code\u003e, the leader serializes all changes to files\n        and notifies the parallel apply workers to read and apply them at the\n        end of the transaction.\n       \u003c/p\u003e","doc_same_as":"","documentation_revision":{"inputs":[{"file":"runtime-config-developer.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"a3f6a107ed6ba4edaf6df03e52f4a469bd09350d545e4ff419e62844025ec1cf","version":"18.7"},{"file":"runtime-config-developer.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"e7e22aa5738a1d376b84af1adca796c5e14746266733f925eb50c3ef86a50655","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"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","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/runtime-config-developer.html","sha256":"3c08bf624188bbb0733dc7854e61c0c251c2578311ac3dc8fa626ab21b7911d1"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"unit":null,"vartype":"enum","zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"GUC-DEBUG-LOGICAL-REPLICATION-STREAMING","file":"runtime-config-developer.html","lang":"en","sha256":"a3f6a107ed6ba4edaf6df03e52f4a469bd09350d545e4ff419e62844025ec1cf","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"debug_logical_replication_streaming","SourceDatabase":"center","Version":"18","Locale":"en","Title":"debug_logical_replication_streaming","Summary":"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.","BodyHTML":"\u003cp\u003e\n        The allowed values are \u003ccode\u003ebuffered\u003c/code\u003e and\n        \u003ccode\u003eimmediate\u003c/code\u003e. The default is \u003ccode\u003ebuffered\u003c/code\u003e.\n        This parameter is intended to be used to test logical decoding and\n        replication of large transactions.  The effect of\n        \u003ccode\u003edebug_logical_replication_streaming\u003c/code\u003e is different for the\n        publisher and subscriber:\n       \u003c/p\u003e\u003cp\u003e\n        On the publisher side, \u003ccode\u003edebug_logical_replication_streaming\u003c/code\u003e\n        allows streaming or serializing changes immediately in logical decoding.\n        When set to \u003ccode\u003eimmediate\u003c/code\u003e, stream each change if the\n        \u003ca href=\"/docs/18/sql-createsubscription.html#SQL-CREATESUBSCRIPTION-PARAMS-WITH-STREAMING\" rel=\"nofollow\"\u003e\u003ccode\u003estreaming\u003c/code\u003e\u003c/a\u003e\n        option of\n        \u003ca href=\"/docs/18/sql-createsubscription.html\" title=\"CREATE SUBSCRIPTION\" rel=\"nofollow\"\u003e\u003ccode\u003eCREATE SUBSCRIPTION\u003c/code\u003e\u003c/a\u003e\n        is enabled, otherwise, serialize each change.  When set to\n        \u003ccode\u003ebuffered\u003c/code\u003e, the decoding will stream or serialize\n        changes when \u003ccode\u003elogical_decoding_work_mem\u003c/code\u003e is reached.\n       \u003c/p\u003e\u003cp\u003e\n        On the subscriber side, if the \u003ccode\u003estreaming\u003c/code\u003e option is set to\n        \u003ccode\u003eparallel\u003c/code\u003e, \u003ccode\u003edebug_logical_replication_streaming\u003c/code\u003e\n        can be used to direct the leader apply worker to send changes to the\n        shared memory queue or to serialize all changes to the file.  When set to\n        \u003ccode\u003ebuffered\u003c/code\u003e, the leader sends changes to parallel apply\n        workers via a shared memory queue.  When set to\n        \u003ccode\u003eimmediate\u003c/code\u003e, the leader serializes all changes to files\n        and notifies the parallel apply workers to read and apply them at the\n        end of the transaction.\n       \u003c/p\u003e","SourceRevision":"wiki-repair-20261023:352549c9bd01b31620d5c59da6dc8ce9544c6dc56bf3b77b5f5fec90b3b23262","ContentHash":"edddd53b0e1917b3fd758dcaf4edeafc3eebf2b6f46227f6ddd945c45167c0ee","Payload":{"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."}},"RequestedLocale":"en","Fallback":false,"Versions":["16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
