Java Zero to All All questionsPractise free
Interview questions › System Design › Scalability Fundamentals

What makes a bad shard key, and why is resharding so painful?

Level III · MidScalability Fundamentals
Short answer

A bad shard key is low-cardinality or monotonically increasing (auto-increment IDs, timestamps): all new writes funnel to one shard, creating a hot spot, while other shards sit idle.

Explanation

It also breaks down if common queries don't include the key, forcing scatter-gather across every shard. Resharding hurts because moving a key's data invalidates routing for in-flight reads/writes and breaks consistent-hash assumptions; the production mitigation is to over-provision logical shards up front (e.g., 1024 virtual shards mapped onto fewer physical nodes) so rebalancing moves whole virtual shards without rehashing keys.

Common mistakes
  • Choosing a low-cardinality or monotonically increasing shard key.
  • Not planning how to reshard before you need to.

Can you say this out loud in two minutes? Drill it in a timed mock interview, with flashcards and runnable code for Scalability Fundamentals.

Practise free

More on Scalability Fundamentals