DynamoDB Top Scores Query Performance
A company uses Amazon DynamoDB for a gaming leaderboard. The table has a primary key of GameId (partition key) and Score (sort key). The application needs to retrieve the top 10 scores for a given game. Which strategies can improve query performance? (Choose TWO.)
Quick Answer
The answer is to use a Global Secondary Index with Score as the sort key and to implement DynamoDB Accelerator (DAX) for caching. Creating a GSI with Score as the sort key allows DynamoDB to perform efficient range queries using the sort key’s inherent ordering, so the top 10 scores for a given GameId can be retrieved in descending order without a full table scan. DAX then caches those frequent top-scores queries, reducing read latency and offloading read capacity units from the base table. On the AWS Certified Data Engineer Associate DEA-C01 exam, this scenario tests your understanding of how to optimize DynamoDB query performance for leaderboard patterns—a common trap is trying to use a scan with a filter or relying solely on the base table’s sort key when the partition key is GameId, which limits efficient sorting across all scores. Remember the memory tip: “GSI for sorting, DAX for caching” to pair the right tools for top-scores performance.
⚠ Common exam trap
Watch out — candidates often think a Scan with a limit is efficient for top-N queries, but DynamoDB Scans always read the entire dataset up to the limit, making them unsuitable for sorted retrieval without additional processing.
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
✓
Create a global secondary index with Score as sort key
Creating a global secondary index (GSI) with Score as the sort key allows efficient range queries on scores for a given GameId. DynamoDB can then use the GSI to retrieve the top 10 scores in sorted order without scanning the entire table, leveraging the index's sort key to fetch only the highest values.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Change the primary key to a single attribute
Why it's wrong here
Would not support efficient top-N queries.
- ✓
Create a global secondary index with Score as sort key
Why this is correct
Allows efficient sorted queries.
- ✗
Use a Scan operation with a limit
Why it's wrong here
Scan is inefficient and expensive.
- ✗
Increase the write capacity units
Why it's wrong here
Write capacity does not improve read performance.
- ✓
Use DynamoDB Accelerator (DAX) for caching
Why this is correct
Reduces read latency.
Go deeper
Related to this question
About these practice questions
One of 1,711 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 →
Same concept, more angles
1 more way this is tested on DEA-C01
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. 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?
hard- ✓ A.Use a Query operation on the base table with ScanIndexForward set to false.
- B.Enable DynamoDB Streams and use a Lambda function to compute the leaderboard.
- C.Use DynamoDB Accelerator (DAX) to cache the results of a Scan operation.
- D.Create a Global Secondary Index with the same partition key and sort key, then query with ScanIndexForward false.
Why A: 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.
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.