{"Entry":{"collection":"guc","key":"logical_decoding_work_mem","name":"logical_decoding_work_mem","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Resource Usage / Memory","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"12","status":"added","to":"13"},{"documentation_changed":true,"fields":{},"from":"18","status":"changed","to":"19"}],"content_hash":"351b66a737a5560b986fdc6e4d146539def52fdb41a30462e43b84acd363ac41","context":"","default_changed_in":[],"default_history":[{"from":"13","to":"19","value":"64 MiB"}],"derived_content_hash":"7822ddfac0538cc80ff5bd48a8d2b224d742902c7125e1bce8209ea681ef4d49","editorial":{"advice":{"olap":"Benchmark logical_decoding_work_mem with representative bulk and scan phases. Include sustained throughput, spill/writeback, and interference with other sessions, not only one operation's elapsed time.","oltp":"Change logical_decoding_work_mem only after identifying the corresponding resource bottleneck under concurrency. Budget total memory, I/O, disk, or kernel capacity rather than optimizing one process in isolation.","small":"Keep logical_decoding_work_mem conservative on a small host and prefer the upstream default when evidence is weak. A setting copied from a large server can consume a disproportionate share of resources."},"mechanism":["logical_decoding_work_mem is the real memory threshold for one logical decoding stream before decoded changes are written to local temporary files. It is independent of ordinary query work_mem.","Each replication connection uses one such buffer, and concurrency is bounded by replication sender capacity rather than client sessions. Large in-progress transactions can spill and later be reread.","Raising the threshold can reduce serialization I/O for logical replication, but the cluster memory budget must multiply it by concurrent decoding streams and include output-plugin memory outside this accounting. Its user context permits session- or transaction-local changes; newly performed or newly planned work sees the value."],"pitfalls":["Changing logical_decoding_work_mem without applying its documented unit and configuration context.","Optimizing an isolated benchmark while ignoring concurrent aggregate resource use.","Assuming a configured value guarantees operating-system or storage behavior.","Failing to retest startup, failover, and workload latency after the change."],"references":[{"title":"PostgreSQL 19 Beta 4: logical_decoding_work_mem","url":"https://www.postgresql.org/docs/19/runtime-config-resource.html#GUC-LOGICAL-DECODING-WORK-MEM"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["work_mem","max_wal_senders","max_replication_slots","debug_logical_replication_streaming","temp_file_limit"],"summary":"logical_decoding_work_mem — Sets the maximum memory to be used for logical decoding. Observed in PG13–19 Beta 4; its last measured boot default is 64 MiB in PG19 Beta 4, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"13","group":"Resource Usage","group_slug":"resource","imported_at":"2026-09-27T17:57:31.660235+08:00","intro_commit":{"authored_at":"2019-11-16T17:49:33+05:30","discussion":["https://postgr.es/m/688b0b7f-2f6c-d827-c27b-216a8e3ea700@2ndquadrant.com"],"hash":"cec2edfa7859279f36d2374770ca920c59c73dd8","subject":"Add logical_decoding_work_mem to limit ReorderBuffer memory usage.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=cec2edfa7859279f36d2374770ca920c59c73dd8"},"key":"logical_decoding_work_mem","last_version":"20","max_val":"","min_val":"","name":"logical_decoding_work_mem","position":258,"present_in":["13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"english-manuals:70deb7d3470eb5421bc08f19b87c0512da9bea98f186b6b585a75f9bf1ac8629","receipt_sha256":"a6897b88226bed06f2fc66d86cd9085860cdbec4da634e67b533afe09e902a90","repair":"wiki-repair-20261023"},"short_desc":"Specifies the maximum amount of memory to be used by logical decoding, before some of the decoded changes are written to local disk.","short_desc_zh":"","source_rev":"wiki-repair-20261023:7b10b7347457d36e6111b942bd7e27a1658c8a27d0e09f3e4d8248a304258b40","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"logical_decoding_work_mem","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"logical_decoding_work_mem","SourceRevision":"wiki-repair-20261023:7b10b7347457d36e6111b942bd7e27a1658c8a27d0e09f3e4d8248a304258b40","Facts":{"boot_val":"65536","category":"Resource Usage / Memory","context":"user","description":"Specifies the maximum amount of memory to be used by logical decoding, before some of the decoded changes are written to local disk. This limits the amount of memory used by logical streaming replication connections. It defaults to 64 megabytes (64MB). Since each replication connection only uses a single buffer of this size, and an installation normally doesn't have many such connections concurrently (as limited by max_wal_senders), it's safe to set this value significantly higher than work_mem, reducing the amount of decoded changes written to disk.","description_zh":"指定逻辑解码在将部分已解码的更改写入本地磁盘之前可使用的最大内存量。它限制了流式逻辑复制连接使用的内存量。默认值为 64 兆字节（64MB）。由于每个复制连接仅使用一个此大小的缓冲区，而一个数据库系统通常不会同时有很多此类连接（受 max_wal_senders 限制），因此可以安全地将该值设得远高于 work_mem，以减少写入磁盘的已解码更改数量。","description_zh_html":"\u003cp\u003e\n        指定逻辑解码在将部分已解码的更改写入本地磁盘之前可使用的最大内存量。它限制了流式逻辑复制连接使用的内存量。默认值为 64 兆字节（\u003ccode class=\"literal\"\u003e64MB\u003c/code\u003e）。由于每个复制连接仅使用一个此大小的缓冲区，而一个数据库系统通常不会同时有很多此类连接（受 \u003ccode class=\"varname\"\u003emax_wal_senders\u003c/code\u003e 限制），因此可以安全地将该值设得远高于 \u003ccode class=\"varname\"\u003ework_mem\u003c/code\u003e，以减少写入磁盘的已解码更改数量。\n       \u003c/p\u003e","doc":{"anchor":"GUC-LOGICAL-DECODING-WORK-MEM","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"This much memory can be used by each internal reorder buffer before spilling to disk.","lang":"en","max_val":"2147483647","metadata_version":"18","min_val":"64","name":"logical_decoding_work_mem","short_desc":"Sets the maximum memory to be used for logical decoding.","source":"pg-settings-source-snapshot","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/runtime-config-resource.html","sha256":"f5fedbf88ec5f973aaf4e525c03e46dda2a2186dabee154e26780da96b2ac85a"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"unit":"kB","vartype":"integer","zh_from":"same-version-pgdoc"},"ManualEvidence":{"doc":{"anchor":"GUC-LOGICAL-DECODING-WORK-MEM","file":"runtime-config-resource.html","lang":"en","sha256":"2e207c599f0884dfbe594558c478a2c7c132578981071e980e2015f31dfce28c","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"logical_decoding_work_mem","SourceDatabase":"center","Version":"18","Locale":"en","Title":"logical_decoding_work_mem","Summary":"Specifies the maximum amount of memory to be used by logical decoding, before some of the decoded changes are written to local disk. This limits the amount of memory used by logical streaming replication connections. It defaults to 64 megabytes (64MB). Since each replication connection only uses a single buffer of this size, and an installation normally doesn't have many such connections concurrently (as limited by max_wal_senders), it's safe to set this value significantly higher than work_mem, reducing the amount of decoded changes written to disk.","BodyHTML":"\u003cp\u003eSpecifies the maximum amount of memory to be used by logical decoding, before some of the decoded changes are written to local disk. This limits the amount of memory used by logical streaming replication connections. It defaults to 64 megabytes (64MB). Since each replication connection only uses a single buffer of this size, and an installation normally doesn\u0026#39;t have many such connections concurrently (as limited by max_wal_senders), it\u0026#39;s safe to set this value significantly higher than work_mem, reducing the amount of decoded changes written to disk.\u003c/p\u003e","SourceRevision":"wiki-repair-20261023:7b10b7347457d36e6111b942bd7e27a1658c8a27d0e09f3e4d8248a304258b40","ContentHash":"6a762d644392c6bda82f568511e40dcdb3345e9b0105240fe6da1ee76cdbfb2c","Payload":{"description":"Specifies the maximum amount of memory to be used by logical decoding, before some of the decoded changes are written to local disk. This limits the amount of memory used by logical streaming replication connections. It defaults to 64 megabytes (64MB). Since each replication connection only uses a single buffer of this size, and an installation normally doesn't have many such connections concurrently (as limited by max_wal_senders), it's safe to set this value significantly higher than work_mem, reducing the amount of decoded changes written to disk."}},"RequestedLocale":"en","Fallback":false,"Versions":["13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
