Architecture
Source — EC2PublicationReplication slotSubscriptionTarget — VPS
The problem
A 500 GB production PostgreSQL database had to move hosts. A dump-and-restore would have meant hours of downtime.
Approach
- Replicated schema first, then streamed data with PostgreSQL logical replication.
- Used publications for non-partitioned tables and handled partitioned tables separately.
- Resolved replication-slot, OID-mismatch and disk-space issues during the sync.
- Cut over once the subscriber had caught up, then fixed sequences.
Outcome
- Production kept running during the bulk copy; downtime limited to the final cutover.