AdvancedAdvanced PostgreSQL
Theory: Logical vs Physical Replication
The query
SQL
-- Q: What is the difference between Logical and Physical Replication?
-- A: Physical replication creates an exact byte-for-byte copy of the entire
-- database cluster by streaming WAL files. (All DBs, all tables).
-- Logical replication operates at the statement/data level using a Pub/Sub model.
-- It allows replicating specific tables, filtering rows, and even replicating
-- across different PostgreSQL major versions.Note
“Logical replication is ideal for zero-downtime upgrades.