Configuration parameter

logical_decoding_work_mem — PostgreSQL configuration parameter

Category Resource Consumption Default 64 megabytes (64MB

Specifies the maximum amount of memory to be used by logical decoding, before some of the decoded changes are written to local disk.

At a glance

Property Value
Parameter logical_decoding_work_mem
Category Resource Consumption
Default 64
Value type integer
Change scope Per-session (SET)
Available in PostgreSQL 13, 14, 15, 16, 17, 18, 19 (added in 13)

What it does

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 streaming logical 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 quoted from the official PostgreSQL documentation.)

How to apply a change

Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.

Inspect the current value and source with SHOW logical_decoding_work_mem; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'logical_decoding_work_mem';.

Tuning guidance

Raise it on publishers with large transactions so logical decoding spills less to disk; size it against RAM and the number of active walsenders, since each replication connection can use up to this much.

Reference

PostgreSQL documentation — logical_decoding_work_mem.

Keep going

Related & next steps

Concepts on this page

Was this helpful?

← All configuration parameters