How do read replicas help scale a database, and what is replication lag?
What they are really testing: Whether you understand splitting reads to replicas while writes go to the primary, and the consequence of asynchronous replication, stale reads and read-after-write issues.
A real interview question
How do read replicas help scale a database, and what is replication lag?
What most people say
drag me
“You add read replicas to spread the load and make the database faster.”
It captures read scaling but ignores that replicas do not help writes and, critically, replication lag, which causes stale reads and the read-after-write problem. Missing that leads to confusing user-facing bugs.
The follow-ups they ask next
Do read replicas help with write scaling?
No. All writes go to the single primary; replicas only scale reads. For write/storage scale you need sharding/partitioning or a different datastore. Reaching for replicas to fix a write bottleneck is a common mistake.
How do you handle the read-after-write problem?
Route reads that need to see the latest write to the primary (read-your-own-writes), or use synchronous/semi-sync replication for those paths, while sending lag-tolerant reads to replicas. And monitor replication lag.
What the interviewer is listening for
- Reads to replicas, writes to primary
- Knows replicas do not scale writes
- Knows replication lag + read-after-write handling
What sinks the answer
- Thinks replicas scale writes
- Unaware of replication lag
- No notion of stale/read-after-write
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“Read replicas [serve read-only queries, offloading reads from the primary, scale reads by adding more]. [Writes still go to the single primary, which replicates out, so replicas do not scale writes]. [Async replication causes replication lag, replicas can be stale]. So [route read-after-write/fresh reads to the primary, lag-tolerant reads to replicas, and monitor lag].”
Keep going with databases
Foundation
What is a database index, how does it speed up queries, and what does it cost?
Foundation
What are the ACID properties of a database transaction?
Foundation
What is normalization, and what are primary and foreign keys?
Junior
A query is slow in production. How do you diagnose and fix it?
Junior
Why is database connection pooling important, especially at scale?
Mid
Under load, your RDS instance is the bottleneck and the app is slowing down. Walk me through your options, in order.
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free