Migrating By Replicating
A clean way to move to a new database is to make the target a replica of the source. The source streams its ongoing changes into the target until both are in sync, then you switch traffic over.
Two Phases
- Initial snapshot: copy the existing data in bulk to seed the target.
- Ongoing replication: stream changes committed after the snapshot so the target keeps catching up.
Tools like AWS DMS or native logical replication combine these so the target converges to within seconds of the source.
Watching The Lag
The key metric is replication lag, how far behind the target is. Before cutover you wait for lag to fall near zero. A small lag means a brief, controlled switch rather than a long outage. Heterogeneous migrations, where source and target are different engines, also need type mapping so each source column lands in a compatible target type.
Key idea
Replication based migration seeds the target with a snapshot then streams ongoing changes until replication lag nears zero, enabling a brief controlled cutover.