Maximum number of parallel apply workers per subscription.
At a glance
| Property | Value |
|---|---|
| Parameter | max_parallel_apply_workers_per_subscription |
| Category | Replication |
| Default | (see documentation) |
| Value type | integer |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 16, 17, 18, 19 (added in 16) |
What it does
Maximum number of parallel apply workers per subscription. This parameter controls the amount of parallelism for streaming of in-progress transactions with subscription parameter streaming = parallel.
The parallel apply workers are taken from the pool defined by max_logical_replication_workers.
(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 max_parallel_apply_workers_per_subscription; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'max_parallel_apply_workers_per_subscription';.
Tuning guidance
Raise it to apply large streamed transactions in parallel on the subscriber, reducing apply lag; it costs worker slots and only helps when transactions are big enough to stream.
Reference
PostgreSQL documentation — max_parallel_apply_workers_per_subscription.