System Design · Senior · Question 3 of 75
Why is choosing "creation date" as a sharding key dangerous?
- ✓Correct answer: All new records land in one shard - a hot partition
- 2Dates can't be used as keys in databases
- 3Records with the same date will be deleted as duplicates
Explanation
Sharding distributes data across nodes; the key must spread the load evenly and match the queries. A monotonic key concentrates writes in the last shard. A hash of the user id or a composite key is often used.