DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Replication / Subscribers

max_sync_workers_per_subscription

Maximum number of table synchronization workers per subscription.

  • Default: 2
  • Type: integer
  • Range: 0 … 262143
  • Applies: Reload

In plain words

When you create a subscription (or add tables to a publication and refresh), each table's existing data is copied first by a table synchronization worker. This sets how many tables one subscription may copy at the same time. More workers finish the initial copy sooner but put more load on both servers.

For DBAs and operators

One sync worker per table, at most this many per subscription, all taken from max_logical_replication_workers. Each one opens its own replication connection and replication slot on the publisher (the slot is dropped once the table is synchronized) (counting against max_wal_senders and max_replication_slots there).

Per-table progress is in pg_subscription_rel.srsubstate: i init, d data copy, f finished copy, s synchronized, r ready.

SELECT srrelid::regclass, srsubstate FROM pg_subscription_rel
 WHERE srsubstate <> 'r';

For a large initial load, raise this together with the worker pool, and make sure the publisher has spare WAL senders and slots. The bottleneck is usually COPY speed and index maintenance on the subscriber.

How to change it

Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().

See it in context

Logical replication workers Logical replication

Related parameters

max_logical_replication_workers max_parallel_apply_workers_per_subscription max_wal_senders max_replication_slots

All Replication parameters