Parameter · Replication / Subscribers
max_logical_replication_workers
Maximum number of logical replication worker processes.
- Default:
4 - Type: integer
- Range: 0 … 262143
- Applies: Restart required
In plain words
On a subscriber, every subscription needs an apply worker, and while tables are first copied it also uses table synchronization workers; streamed large transactions can use parallel apply workers. They all come from this one pool. When it is empty, new workers simply do not start and replication for that subscription stalls until one frees up.
For DBAs and operators
The pool is itself carved out of max_worker_processes, so raise that too. Sizing: number of subscriptions + max_sync_workers_per_subscription × subscriptions syncing at once + parallel apply workers. When it is exhausted the launcher logs:
WARNING: out of logical replication worker slots
HINT: You might need to increase "max_logical_replication_workers".
and retries after wal_retrieve_retry_interval. Initial sync of many tables is the classic trigger.
SELECT subname, worker_type, pid, relid::regclass, latest_end_lsn
FROM pg_stat_subscription;(worker_type is apply, table synchronization or parallel apply, PostgreSQL 17+.)
How to change it
Change in postgresql.conf or ALTER SYSTEM, then restart the server.
See it in context
Logical replication workers Logical replication Parallel and background workers Logical decoding and ReorderBuffer
Related parameters
max_sync_workers_per_subscription max_parallel_apply_workers_per_subscription max_worker_processes max_active_replication_origins