Replication ایک primary ڈیٹابیس سے ڈیٹا کو ایک یا زیادہ replica (standby) سرورز کو کاپی کرتی ہے — high availability (اگر primary ناکام ہو تو failover) اور read scaling (read queries کو تقسیم کریں) کے لیے۔ 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
