レプリケーションは、プライマリデータベースから1つ以上のレプリカ(スタンバイ)サーバーにデータをコピーします。高可用性(プライマリが失敗した場合のフェイルオーバー)と読み取りスケーリング(読み取りクエリの分散)のためです。PostgreSQLは主にストリーミングレプリケーション(物理レプリケーション)を使用し、これはwrite-ahead log(WAL)に基づいています。
ストリーミング(物理)レプリケーション
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
