Copying data to another server.
WHAT IT DOES
Keeps a second server holding a copy of the first.
WHAT IT IS USED FOR
Reading from a second server, spreading load A standby for failure Backups taken without touching the primary Reporting isolated from the live system
WHAT IT IS NOT
A backup.
WHY NOT
A deletion replicates faithfully and instantly.
WHAT THE MECHANISM IS
The primary records changes; the replica reads and applies them.
WHAT ASYNCHRONOUS MEANS
The primary does not wait for the replica.
WHAT THAT RISKS
Losing recent changes if the primary fails.
WHAT SEMI-SYNCHRONOUS ADDS
Waiting for at least one replica to acknowledge.
WHAT IT COSTS
Latency on every commit.
WHAT REPLICATION LAG IS
How far behind the replica is.
WHY IT MATTERS
Reading from a lagging replica returns stale data.
WHAT THAT CAUSES IN APPLICATIONS
A record written then immediately not found.
WHAT TO DO ABOUT IT
Read from the primary immediately after writing.
WHAT TO MONITOR
Lag, continuously, with an alert.
WHAT BREAKS REPLICATION
Writes made directly on the replica Statements that behave differently on each
WHAT TO CONFIGURE
The replica as read-only.