Replication คัดลอกข้อมูลจากฐานข้อมูล primary ไปยังเซิร์ฟเวอร์ replica (standby) หนึ่งตัวขึ้นไป เพื่อ high availability (failover หาก primary ล้มเหลว) และ read scaling (กระจาย query สำหรับอ่าน) PostgreSQL ใช้ streaming replication (physical) เป็นหลัก ซึ่งอิงกับ 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
