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

Pre-Splitting and Initial Shard Count

Start with enough shards to avoid immediate resharding, balancing overhead with future growth expectations.

Pre-Splitting and Initial Shard Count

What you'll learn: How to start with the right number of shards from day one to avoid costly early resharding.


When you first implement sharding, you face a critical decision: how many shards should you create initially? Pre-splitting means creating multiple shards before you have enough data to fill them, rather than starting with one shard and splitting later.

The Balancing Act

Think of shards like moving boxes when packing for a new house. You could start with one giant box and split your belongings later when it gets too heavy, or you could use several boxes from the start. Pre-splitting is choosing multiple boxes upfront, even if some start empty.

Creating too few shards means you'll hit capacity limits quickly and need to reshard soon—an expensive, complex operation. Creating too many shards adds unnecessary overhead: each shard requires its own resources, monitoring, and management complexity.

How to Choose

Consider your growth expectations:

  • If you expect 10x growth in the next year, start with enough shards to handle that without immediate resharding
  • A common strategy: create 2-4x more shards than you currently need
  • Example: If you need 4 shards today, create 8-16 to accommodate growth

Many databases and frameworks support pre-splitting. You define shard boundaries upfront (using hash ranges or keys), even though most shards will be empty initially. As data grows, it naturally distributes across the pre-created shards.

Real-World Example

MongoDB allows pre-splitting when you create a sharded collection. Instead of starting with 1 chunk and waiting for it to split as it grows, you can create 64 empty chunks immediately, distributed across your shard servers.

Key Takeaway: Start with enough shards to avoid resharding in the near term, but not so many that management overhead outweighs the benefits—plan for 2-4x your current needs based on realistic growth projections.