Interview practice question
Leaderboard query is too slow
System Design · Databases · Intermediate
A game's leaderboard query sums scores across 500 million rows and takes 20 seconds. It is shown on the home screen. How do you fix it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Do not compute on every read.
- Maintain running totals per player.
- Sorted set in Redis for ranking.
- Update incrementally on each score.
- Periodic full recompute for correctness.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.