Replication copies data from a primary database to one or more replica (standby) servers — for high availability (failover if the primary fails) and read scaling (distribute read queries). PostgreSQL primarily uses streaming replication (physical) based on the write-ahead log (WAL).
Streaming (physical) replication
Primary ──(streams WAL: the write-ahead log of changes)──▶ Replica(s)
✓ The primary handles all WRITES
✓ Replicas continuously apply the primary's WAL → stay in sync (near-real-time)
✓ Replicas can serve READ queries ("hot standby") → scale reads
