Decision guide
Scaling Reads: Cache, Replicas or Read Models?
Reads are overloading the database — where should they go?
Side by side
| Criterion | Fix queries and indexes | Cache (HTTP/CDN and Redis) | Read replicas | Read models / materialized views |
|---|---|---|---|---|
| Staleness | None | TTL / invalidation lag | Replication lag (ms–s) | Refresh/consumer lag |
| Scale gained | Often 10×+ for the fixed query | Very high for hot keys | Linear per replica | High for the precomputed queries |
| Complexity | Low | Medium (invalidation, stampedes) | Medium (routing, lag) | Medium–high (pipelines, rebuilds) |
| Cost | Lowest | Low per request | A full database per replica | Storage + pipeline |
When to choose each
Fix queries and indexes
Measure with pg_stat_statements; fix N+1, missing indexes and OFFSET pagination.
Choose when
- Always first
- A few statements dominate total time
Avoid when
- Load is already efficient per query and simply too high
Cache (HTTP/CDN and Redis)
Serve repeated reads from memory or the edge.
Choose when
- Hot, repeated reads with tolerable staleness
- Read traffic far above write traffic
- Expensive computed responses
Avoid when
- Data that must be exactly fresh (balances, checkout stock)
- Highly personalized, low-reuse responses
Read replicas
Copies of the database that serve reads, slightly behind the primary.
Choose when
- Many varied reads that can't be cached well
- Analytics or reporting isolation
Avoid when
- Read-after-write paths without read-your-writes routing
- Write-heavy load
Read models / materialized views
Precompute the shape reads need (summaries, search indexes, denormalized views).
Choose when
- Expensive aggregates or joins on every read
- Search and filtering across many fields
Avoid when
- Rapidly changing data needing immediate consistency
- Small datasets
Verdict
Fix queries first, then cache what's hot and tolerates staleness, add replicas for varied reads with read-your-writes routing, and build read models for expensive aggregates and search. Classify every read by its freshness need before choosing.
Learn more
- Caching and Performance Engineering
- Scaling Databases & Data Consistency
- Caching
- Databases & Transactions
- Performance & Scalability