Interview practice question
Unique usernames across shards
System Design · Databases · Experienced
Users are sharded by user ID, but usernames must be globally unique. How do you enforce that?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Uniqueness needs one authority per value.
- Separate username table keyed by username.
- Conditional insert (insert if not exists).
- Reserve username, then create user.
- Clean up failed reservations.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.