{"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"}],"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"],"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":"english-manuals:70deb7d3470eb5421bc08f19b87c0512da9bea98f186b6b585a75f9bf1ac8629","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"logical_decoding_work_mem","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"logical_decoding_work_mem","SourceRevision":"english-manuals:70deb7d3470eb5421bc08f19b87c0512da9bea98f186b6b585a75f9bf1ac8629","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.","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","unit":"kB","vartype":"integer"},"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":"english-manuals:70deb7d3470eb5421bc08f19b87c0512da9bea98f186b6b585a75f9bf1ac8629","ContentHash":"e1d0b3d9b66bd96a86f8cc5af1558cdaac6482dda65dfb467f8b54f584093eca","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":"zh-Hans","Fallback":true,"Versions":["13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
