1

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.

1 Answer 1

1

Yes,

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 r1,r4.

Here is sample usage;

ALTER SYSTEM SET synchronous_standby_names TO 'ANY 3 (r1, r2, r3, r4)';
SELECT pg_reload_conf();

Note: The standby names (which are r1,r2..) are defined by application_name option of standby's primary_conninfo setting value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.