Search code examples
databasepostgresqlreplicationsynchronousdatabase-cluster

Why in cluster PSQL with 3 node one node - sync_state= sync and next node sync_state= async?


I want PostgreSQL Synchronous Streaming Database Replication Status = sync.

I deployed PostgreSQL cluster with 3 node and write sync type - Synchronous. But when i check type SELECT * FROM pg_stat_replication; - i get first node - sync_state=sync,and other async, what is ? Why its two different type ?


Solution

  • With synchronous streaming replication in PostgreSQL, the commit on the primary is delayed until one of the standby servers has received the corresponding WAL information (the exact meaning of this is configurable with synchronous_commit).

    The standby server who first confirms the reception of the WAL information is the one with sync_state 'sync', the other will be 'async'.