Free AWS DVA-C02 Actual Exam Questions - Question 5 Discussion
team uses an Amazon DynamoDB table.
Every record includes the following
• A Review ID a 16-digrt universally unique identifier (UUID)
• A Product ID and User ID 16 digit UUlDs that reference other tables
• A Product Rating on a scale of 1-5
• An optional comment from the user
The table partition key is the Review ID. The most performed query against the table is to find the 10
reviews with the highest rating for a given product.
Which index will provide the FASTEST response for this query"?
A/B? Since we want to filter by Product ID and sort by rating, having Product Rating as the sort key (A) makes more sense than Review ID (B) for fast retrieval of top ratings.
A This will let you quickly find all reviews for a product and sort them by rating, which matches exactly what the query needs. LSIs can’t change the partition key, so they won’t help here.
A/B? I know LSIs require the same partition key as the base table, and since the base table uses Review ID as the partition key, C and D are out. Between A and B, A uses Product ID as partition key and Product Rating as sort key, which fits the query to get top ratings for a product. B sorts by Review ID, which won’t help with sorting by rating. So A should be fastest because it matches the query pattern exactly.
A, because GSIs let you query by product and sort by rating efficiently.
This question seems tricky because it mixes GSIs and LSIs, and the partition key choice really matters here. For the fastest response to “top 10 reviews with highest rating for a product,” I think option C makes sense since an LSI with Product ID as partition key and Product Rating as sort key supports range queries and sorting better within the same partition. But not 100% sure if the Review ID as a partition key in the main table messes that up. Anyone else struggle with this one? I’m going with C.