DynamoDB Top Scores Query Performance
A company uses Amazon DynamoDB for a gaming leaderboard. The table has a partition key of 'GameId' and a sort key of 'Score'. The application needs to query the top 10 scores for a given game. Which DynamoDB feature should be used for optimal performance?
⚠ Common exam trap
Candidates often mistakenly think they need a GSI when the base table already has the optimal sort key. The trap is to assume that queries on the base table are inefficient, but DynamoDB can efficiently query with the sort key condition and ScanIndexForward.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use a Query operation on the base table with ScanIndexForward set to false.
The base table already has 'GameId' as partition key and 'Score' as sort key. A Query operation on the base table with ScanIndexForward set to false retrieves items in descending order by Score, so the first 10 items are the top scores. This is efficient without additional cost or complexity. Option D is unnecessary and incurs extra storage cost.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Use a Query operation on the base table with ScanIndexForward set to false.
Why this is correct
A Query on the base table with ScanIndexForward false directly retrieves items in descending order by Score because the base table already has Score as sort key. This is the most efficient and cost-effective method.
- ✗
Enable DynamoDB Streams and use a Lambda function to compute the leaderboard.
Why it's wrong here
Streams and Lambda compute derived leaderboard data asynchronously, adding latency and cost; the query still needs an efficient read path. Streams suit event-driven aggregation or replication triggers, not serving top-N reads directly from the base table.
- ✗
Use DynamoDB Accelerator (DAX) to cache the results of a Scan operation.
Why it's wrong here
DAX caches item reads by key; a Scan reads the whole table and cannot efficiently return the top scores, so caching it does not give optimal performance. It is tempting because DAX accelerates reads, and it would be correct for repeated GetItem or Query access patterns on hot items.
- ✗
Create a Global Secondary Index with the same partition key and sort key, then query with ScanIndexForward false.
Why it's wrong here
A GSI duplicating the base key projects no new access pattern, so the query still reads one partition and cannot return globally ordered top scores across games. GSIs exist to provide an alternative partition or sort key for query flexibility.
Go deeper
Related to this question
About these practice questions
One of 1,321 original DEA-C01 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DEA-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DEA-C01 exam.