How to Improve DynamoDB Query Performance for Non-Key Attributes?
Short answer
B Create a global secondary index (GSI). Set query attribute to be the partition key of the index.
Question
Key Takeaways
The exam tests your understanding of DynamoDB's key-based access patterns; queries on attributes that are not partition/sort keys require a GSI to avoid full table scans.
Learn why creating a global secondary index (GSI) is the recommended AWS solution for DynamoDB queries on non-key attributes, and how it scales as data grows. Community consensus strongly favors GSI over scan or capacity scaling options.
Common mistake: Choosing option C (parallel scan) or option D (read capacity scaling) is common because they appear to improve performance, but they increase cost/complexity and do not solve the underlying issue of querying a non-key attribute. Instead, a GSI creates a new index with the queried attribute as the partition key, enabling efficient query operations.
Expert Analysis
Why the Answer Is Correct
Option B is correct because DynamoDB queries require a partition key and optional sort key. When an attribute is neither a table key nor a sort key, a full table scan is needed. A global secondary index (GSI) lets you define a different partition key (and sort key) for the same data, allowing efficient queries on that attribute. As the table grows, the GSI scales independently and keeps query latency low.
Community comments highlight this directly: one comment notes that creating a GSI is more cost-efficient than increasing RCUs, and another explains that the GSI enables efficient querying based on attributes not originally designed as keys.
Why the Other Options Are Wrong
Option A (increasing page size and retrying) only affects how many items are returned in a single request; it does not change the underlying scan/query behavior. It also may cause throttling and does not help with non-key attribute searches.
Option C (parallel scan) can speed up full-table scans, but it still scans every item in the table, which becomes increasingly expensive and slow as data volume grows. It is not a targeted query solution.
Option D (read capacity auto scaling) improves throughput but does not address the fundamental inefficiency of scanning the entire table. Additionally, comments note that GSI is more cost-efficient than simply raising RCUs.
Community Comment Notes
Comment [1] (10 likes) correctly states that creating a GSI is more cost-efficient than increasing RCUs. Comment [2] (3 likes) gives a detailed explanation of why a GSI is the best solution for non-key attribute queries. Comment [3] (2 likes) correctly points out that parallel scans may not improve performance for specific queries involving non-key attributes. Comments [4], [5], and [6] all agree with B, reinforcing the consensus.
Official Reference
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-indexes.html
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-query-scan.html
These links open the official vendor documentation in a new tab.
Exam Strategy
When you see a DynamoDB question about querying an attribute that is not a table key, immediately consider a global secondary index (GSI). Distinguish between query (efficient, uses key/index) and scan (full table read). Choose GSI over scan or capacity scaling because it directly optimizes the access pattern and scales with data growth.
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 6 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 6
-
tgv 👍 10 Answered BCreating a GSI would be more cost efficient than increasing the RCU in this case.
-
tomchandler077 👍 3To improve the performance of queries that involve an attribute that is neither the table's partition key nor sort key, and anticipating an increase in data volume, the most effective solution is to utilize a global secondary index (GSI). This allows for efficient querying based on different attributes that are critical for performance but not originally designed as keys in the main table structure.
-
be1dca8 👍 2B Parallel scan operations can be useful for scanning large tables, but they may not necessarily improve performance for specific queries involving non-key attributes.
-
albert_kuo 👍 1 Answered Ban attribute that is not the table's partition key or sort key => create GSI to solve this problem
-
nder 👍 2 Answered BGSI :)
Show 1 more comment
-
65703c1 👍 1 Answered BB is the correct answer.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →