Course contentsShow
← System Design
Lesson 239 of 1,9197. Database Scaling: ShardingFree lesson

When Not to Shard

Recognizing scenarios where sharding complexity outweighs benefits: small datasets, read replicas suffice, or immature systems.

When Not to Shard

What you'll learn: You'll discover when sharding adds more complexity than value, helping you avoid premature optimization traps.


The Core Idea

Sharding is a powerful technique for scaling databases horizontally, but it comes with significant operational complexity. Before implementing sharding, you need to honestly assess whether simpler alternatives can solve your problem. Sometimes the "simpler solution" is the right solution.

Scenarios Where Sharding Is Premature

Small or Medium-Sized Datasets
If your entire database comfortably fits on a single modern server (under a few hundred GB with room to grow), sharding adds unnecessary complexity. A single well-tuned database can handle millions of rows efficiently.

Read Replicas Solve the Problem
If your bottleneck is read traffic, not write traffic or storage capacity, read replicas are far simpler than sharding. You can scale read capacity horizontally without the cross-shard query headaches.

Immature or Rapidly Changing Systems
Early-stage applications rarely have stable access patterns. Sharding requires choosing the right shard key upfront—a decision that's extremely costly to change later. If you're still figuring out your data model and user behavior, wait.

Limited Engineering Resources
Sharding requires sophisticated tooling, monitoring, rebalancing strategies, and operational expertise. A small team might spend months building sharding infrastructure that provides marginal benefit while neglecting core product features.

The Cost-Benefit Analysis

Think of sharding like building a highway system for a small town. Yes, it handles massive traffic capacity—but if you only have 100 cars, a few well-maintained roads work better and cost far less to maintain.

Key Takeaway: Sharding should be your last resort for scaling, not your first. Exhaust simpler options like vertical scaling, read replicas, caching, and query optimization before accepting sharding's complexity tax.