Parameter · Developer Options
debug_logical_replication_streaming
Forces immediate streaming or serialization of changes in large transactions. 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.
- Default:
buffered - Type: enum
- Values: buffered · immediate
- Applies: Session (any user)
In plain words
Logical replication normally keeps a transaction's changes in memory until it is big enough to stream or to spill to disk. This switch makes it do so for every single change, so the code paths for large transactions can be tested with small ones.
For DBAs and operators
Added in PostgreSQL 16. Two values:
buffered(default): the publisher's reorder buffer collects changes until logical_decoding_work_mem is exceeded, then streams the largest in-progress transaction (if the subscription hasstreaming = on/parallel) or spills it topg_replslot/<slot>/.immediateon the publisher: every change is streamed (or serialized) at once. On a subscriber withstreaming = parallel, the leader apply worker serializes all changes to files and tells the parallel apply worker to read them at the end of the transaction.
Observe the effect in pg_stat_replication_slots (stream_txns, stream_count, spill_txns, spill_bytes). It is a testing aid; to change real behaviour tune logical_decoding_work_mem and the subscription's streaming option.
Developer option: meant for debugging and testing PostgreSQL itself. Leave it at the default on production servers unless a specific diagnosis calls for it.
How to change it
Any user can change it for their session with SET.
See it in context
Related parameters
logical_decoding_work_mem max_logical_replication_workers max_parallel_apply_workers_per_subscription