Replication and High Availability for PostgreSQL DBAs
Replication and high availability keep PostgreSQL running when a server fails. Streaming replication ships WAL to physical standbys, logical replication copies selected tables through publications and subscriptions, and tools such as Patroni automate failover. It is the availability stage of the PostgreSQL DBA path.
Stage: Reliability · Part of the PostgreSQL DBA roadmap · Last reviewed 19 November 2026
What to learn in Replication and High Availability
- Set up a streaming replica that uses a replication slot
- Create a publication and subscription for logical replication of selected tables
- Explain synchronous versus asynchronous replication and the data loss trade-off
- Monitor replication lag with pg_stat_replication
- Describe how Patroni uses a consensus store to elect a leader and avoid split brain
Replication and High Availability interview questions
What risk does an inactive replication slot create?
A slot makes the primary retain WAL until the consumer has received it. If the standby is down or slow, WAL accumulates and can fill the primary's disk. Monitor slots, and set max_slot_wal_keep_size to cap the retention.
What is the difference between physical and logical replication?
Physical replication streams WAL to build an identical standby of the whole cluster, ideal for failover and read replicas. Logical replication decodes changes per table, allowing different major versions, selected tables and writable targets, but schema changes must be applied separately.
Where Replication and High Availability fits in the PostgreSQL DBA roadmap
Replication and High Availability belongs to the Reliability stage (intermediate level), which takes about 4 hours. Never lose data.
Other units in this stage
Back to the full PostgreSQL DBA roadmap