Primary and replicas
With asynchronous replication, the primary can confirm a write before every replica has applied it. The delay between the primary and a replica is replication lag. A read sent to a lagging replica may not see a write that just succeeded on the primary.
The read-after-write surprise
A user updates a profile and is immediately redirected to a page that reads from a replica. If replication has not caught up, the old profile may appear. Applications can route that user's next read to the primary, wait for a replication position, or use synchronous replication where its latency and availability trade-offs are acceptable.
Failover also needs care: if a primary fails before a confirmed write reaches a promoted replica, that write may be lost depending on the replication mode and failover policy. Define the durability guarantee and recovery point you need.
Replicas do not make every query safe
Read scaling depends on replica capacity and workload. A large analytical query can compete with other replica reads. Monitor lag, replica health, and query load, and ensure backups are independently recoverable.
Replication behavior is product-specific. PostgreSQL supports streaming and synchronous replication modes; other engines use different protocols and guarantees. See CAP theorem.
Choose a consistency policy per read
Not every read needs the same freshness. A dashboard might accept a few seconds of lag, while a confirmation page immediately after a payment should usually read from the primary or wait until the replica has applied that write. Some systems expose a replication position or consistency token that lets an application wait for a particular write. This can improve read scaling without silently showing old state. Define a timeout and fallback for when the replica never catches up within the application's latency budget.
Do not confuse a replica with a backup
A replica can improve availability or provide extra read capacity, but it receives the same logical changes as the primary. An accidental deletion, bad migration, or malicious update can therefore propagate. Keep independent backups with a tested restore procedure and retention policy. Monitor replication lag in units meaningful to the workload—time, log position, or applied transactions—and alert when it exceeds the freshness budget. A healthy replica can still be too stale for a particular request.