論理レプリケーションは、物理(ストリーミング)レプリケーションのようにデータベースクラスタ全体をバイト単位でコピーするのではなく、特定のテーブルのレベルでデータ変更をレプリケートします(パブリッシュ/サブスクライブモデルを使用)。これにより柔軟性が実現され、選択的で、バージョン間で機能し、異なるスキーマへも対応でき、移行と統合に理想的です。
論理レプリケーションと物理レプリケーションの比較
PHYSICAL (streaming) → replicates the ENTIRE cluster at the storage/WAL level
✓ exact copy, simple ✗ all-or-nothing, same Postgres version, read-only replica
LOGICAL → replicates specific TABLES' changes via a publish/subscribe model
✓ SELECTIVE (choose tables), CROSS-VERSION, to DIFFERENT schemas, replica is WRITABLE
✗ more setup, some limitations (DDL not replicated automatically, etc.)
