Range sharding assigns key ranges to shards. Enables efficient range queries but risks hotspots. HBase, BigTable, DynamoDB Global Tables use it.

Query: A-CQuery: X-ZRange scan: J-MShard 1keys A-FShard 2keys G-MShard 3keys N-SShard 4keys T-ZMetadata Routerrange → shardRange queries fastsingle shard scanHotspot risktrending key range
Range sharding: ordered ranges, fast range queries, hotspot risk
Advertisement

The mechanic

Metadata service tracks which shard owns which key range. Query looks up shard, routes.

The mechanic

Metadata service tracks which shard owns which key range. Query looks up shard, routes.

Advertisement

Range queries win

Scanning A-M = hit shards 1+2, sequential reads. Hash sharding requires touching every shard.

Hotspot risk

Recent timestamps → all traffic on newest shard. Auto-incrementing IDs → same problem. Bucket by hash prefix if needed.

Rebalancing

Split hot shard into two. Move half its range to new shard. Neighboring shards unaffected. Much better than hash sharding.

When to use

Time-series (partition by day). Geographic (partition by region). Any query pattern that benefits from ordered scans.

Range for ordered access + easy rebalance. Watch for hotspots on recent/hot ranges.