Explain the difference between a Read Replica and Sharding.
Last updated
A read replica is a full copy of the database synced from the primary. It scales reads, but all writes still go to one primary and replication lag causes eventual consistency.
Sharding splits data into disjoint subsets across servers by a shard key. It scales writes and storage but adds routing and makes cross-shard joins/transactions hard.
Replicas fix read bottlenecks, shards fix write/storage bottlenecks. They are often used together.
- https://www.geeksforgeeks.org/system-design/difference-between-database-sharding-and-replication/
- https://dev.to/behera051/database-replication-sharding-explained-4ffn
- https://www.youtube.com/shorts/1_xLXicErn0
- https://blog.codekerdos.in/read-replicas-vs-database-sharding-they-solve-different-problems/
- https://medium.com/towardsdev/sharding-vs-replication-the-mental-model-youll-actually-understand-2e2a7f2b3d41