A PostgreSQL standby alone is not a complete HA design. Replication mode, WAL retention, failover triggers, client routing, split-brain prevention and backup/recovery must be planned together. Synchronous replication can reduce data-loss risk while increasing commit latency.
PostgreSQL documentation states synchronous replication can require one or more standbys to confirm changes before commit completes. This improves durability but can add network/standby latency. Asynchronous replication can be faster but may lose the latest WAL changes during failover.
Applications can connect through a virtual endpoint, HAProxy or failover-aware service rather than a fixed primary IP. The standby follows the WAL stream and can be promoted when required.
Balance latency tolerance against data-loss tolerance.
Promotion, DNS/LB routing, fencing, client reconnect and replication-slot state should be tested.
Run commands with an appropriately privileged PostgreSQL user.
psql -c "SELECT pg_is_in_recovery();"psql -c "SELECT application_name,state,sync_state,write_lag,flush_lag,replay_lag FROM pg_stat_replication;"psql -c "SELECT pg_current_wal_lsn();"pg_isreadyA bad DELETE, schema mistake or corruption can replicate too. Independent recovery such as base backups plus WAL archive is needed for point-in-time recovery.
There is no single universal number. Primary plus standby can be two data nodes; automated quorum/failover tooling may require additional nodes or witnesses.
It improves commit durability when configured correctly, but full-system failure scenarios, storage and client behavior still need consideration.
A standby/read replica is normally read-only until promoted to primary.
Share DB size, write rate, acceptable data loss and RTO; we can design async/sync standbys and endpoints.