In this question, Write concern in PostgreSQL Laurenz Albe explained how to control the set of standby servers when data is committed to PostgresSQL, and that gave birth to another question. What if I want to have N standbys, and want to have synchronous replication enabled for some M subset of N, is that possible? A use case could be a cold backup. I don't care of data inconsistency for N-M subset, I just need to have that on M subset of N standbys.
There is a setting for this which is called synchronous_standby_names.
You can give expression like
ANY 3 (r1, r2, r3, r4) which says "proceed commit as soon as at least any three standbys reply"
If you want to specify exact replication name just name them like
Here is sample usage;
ALTER SYSTEM SET synchronous_standby_names TO 'ANY 3 (r1, r2, r3, r4)'; SELECT pg_reload_conf();