Configuration parameter

max_sync_workers_per_subscription — PostgreSQL configuration parameter

Category Replication

Maximum number of synchronization workers per subscription.

At a glance

Property Value
Parameter max_sync_workers_per_subscription
Category Replication
Default 2
Value type integer
Change scope Per-session (SET)
Available in PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12)

What it does

Maximum number of synchronization workers per subscription. This parameter controls the amount of parallelism of the initial data copy for tables during the subscription initialization or when new tables are added. One additional worker is also needed for sequence synchronization.

Currently, there can be only one table synchronization worker per table and one sequence synchronization worker to synchronize per subscription.

(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_sync_workers_per_subscription; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'max_sync_workers_per_subscription';.

Tuning guidance

Raise it to copy more tables in parallel during initial subscription sync; it consumes logical replication worker slots, so balance against steady-state apply needs.

Reference

PostgreSQL documentation — max_sync_workers_per_subscription.

Keep going

Related & next steps

Was this helpful?

← All configuration parameters