Postgresql – Maximum number subscribers node in PostgreSQL logical replication

postgresqlreplication

Does anyone know what is the maximum of subscriber nodes with PostgreSQL 11 logical replication ?

Best Answer

The limit built into PostgreSQL is 262143 (218 - 1).

So in theory you could bump up required parameters and have 200k logical rep subscribers.

In reality, you will start hitting performance issues much below this.

For the parameters - see documentation and also see this SQL query:

SELECT category, name, setting, min_val, boot_val, max_val
FROM pg_settings
WHERE category ~* 'replica'
AND name ~* 'max.*(workers|slots|senders)'

I get this:

           category            |               name                | setting | min_val | boot_val | max_val 
-------------------------------+-----------------------------------+---------+---------+----------+---------
 Replication / Subscribers     | max_logical_replication_workers   | 4       | 0       | 4        | 262143
 Replication / Sending Servers | max_replication_slots             | 10      | 0       | 10       | 262143
 Replication / Subscribers     | max_sync_workers_per_subscription | 2       | 0       | 2        | 262143
 Replication / Sending Servers | max_wal_senders                   | 10      | 0       | 10       | 262143
(4 rows)