Replication menyalin data dari database primary ke satu atau lebih server replica (standby) — untuk high availability (failover jika primary gagal) dan read scaling (mendistribusikan query baca). PostgreSQL terutama menggunakan streaming replication (physical) berdasarkan 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
