What they're testing
Whether you know sharding is a last resort, and whether you think about cross-shard queries.
The short answer~30 seconds
Shard only when WRITE volume exceeds one node, after trying read replicas, better indexes, caching, and moving hot tables to their own instance. The shard key should be something nearly every query already filters on — usually tenant_id or user_id — because a query without the key must ask EVERY shard and merge, and that is what kills performance, not sharding itself.
The long answer
Three sharding schemes have three operational profiles. Range sharding is easy to reason about and supports range scans, but creates hot spots — shard by date and today's shard takes all the writes. Hash sharding distributes evenly, in exchange for losing range scans and needing to redistribute nearly everything when you add a shard. Consistent hashing cuts the movement to roughly 1/n, which is why it's the default when you know more shards are coming.
The real pain isn't picking a scheme but everything you give up: no cross-shard foreign keys, cross-shard transactions need coordination, a JOIN across shards moves into the application, and AUTO_INCREMENT stops working so you need UUIDs or Snowflake ids. Each of those is complexity added to EVERY feature you build afterwards, not a one-time setup cost.
For choosing the key, the best test is: list your ten most important queries and count how many already filter on the candidate. Fewer than eight of ten means the wrong key. For multi-tenant systems tenant_id is nearly always right, unless one enormous tenant holds most of the data — then you need a composite key or that tenant on its own, and saying so shows you've met the real problem.
What they'll ask next
?How do you reshard a live system?
Dual-write for a period: write to both layouts, backfill the old data, reconcile, switch reads to the new layout, and only then stop writing the old. Weeks rather than one night, with a way back at every step.
These lose points
- Sharding because "we'll be big later". You pay the full complexity cost today for a scale that may never arrive.
- Choosing a shard key without listing the main queries. That's a decision you can't fix cheaply.
Sources
- Martin Kleppmann, Designing Data-Intensive Applications, ch. 6 — Partitioning
- Vitess — Sharding (MySQL sharding at scale)