Overview

In a replicated database, read queries can be routed to the primary node or to one of the read replicas. The choice trades guaranteed data freshness for the ability to scale read throughput and reduce load on the write path.

Comparison Diagram

ClientPrimaryhandles all writesReplicaread-only copyasync replication (lag)writeread (fresh)read (maybe stale)single node, no lagscales out horizontally

Comparison Table

AspectPrimary ReadsReplica Reads
Read targetAlways the single primary nodeAny of one or more read replicas
Consistency guaranteeRead-your-writes, strongly consistentEventual consistency, may lag behind writes
Replication lag exposureNone, reads the current write state directlyExposed to lag, from milliseconds to seconds
Contention with writesReads compete with writes for CPU, locks, and I/OWrites on primary don’t directly compete with replica reads
Read throughput scalingBounded by single node capacityScales horizontally by adding more replicas
Latency profileConsistent, no wait for replication to catch upCan be lower if replica is geographically closer, but variable under lag
Failover behaviorNode failure requires promotion and brief write/read outageLoad balancer can reroute to another healthy replica
Typical use caseFinancial transactions, read-after-write flows, admin viewsAnalytics, reporting, public APIs, dashboards

Key Differences

  • Primary reads guarantee read-your-writes consistency; replica reads may return stale data due to lag.
  • Replica reads scale horizontally by adding read replicas; primary reads are bottlenecked by a single node.
  • Primary reads compete with write traffic for resources; replica reads isolate read load via replication.
  • Replication lag on replicas ranges from milliseconds to seconds depending on network and write volume.
  • Failover on the primary causes brief unavailability; replica failures are masked by load balancing across peers.

When to Use Each

Primary Reads

  • Read-after-write flows: A user updating their profile must immediately see the new value, which only the primary guarantees.
  • Financial transactions: Balance checks before a transfer need the current committed state to avoid double-spend or overdraft.
  • Admin and audit views: Operators reviewing recent changes need certainty that no pending write is missing from the result.

Replica Reads

  • Analytics and reporting: Aggregating historical data tolerates a few seconds of lag and benefits from offloading the primary.
  • Public read-heavy APIs: High request volume for content like catalogs or feeds scales better by spreading reads across replicas.
  • Geographically distributed reads: A replica placed near end users reduces network latency even if the data is briefly stale.