DVA-C02 · Question #590
DVA-C02 Question #590: Real Exam Question with Answer & Explanation
The correct answer is A: Create a DynamoDB global secondary index (GSI) on the table. Use CustomerID as the partition. The requirement is to query records by CustomerID, which is not the current partition key To achieve this efficiently: A Global Secondary Index (GSI) allows developers to create a different partition key and optional sort key for querying the data. By creating a GSI with Customer
Question
A bookstore has an ecommerce website that stores order information in an Amazon DynamoDB table named BookOrders. The DynamoDB table contains approximately one million records. The table uses OrderID as a partition key. There are no other indexes. A developer wants to build a new reporting feature to retrieve all records from the table for a specified customer, based on a CustomerID property. Which solution will meet this requirement in the most efficient way?
Options
- ACreate a DynamoDB global secondary index (GSI) on the table. Use CustomerID as the partition
- BCreate a DynamoDB global secondary index (GSI) on the table. Use CustomerID as the sort key.
- CCreate a DynamoDB local secondary index (LSI) on the table. Use CustomerID as the sort key.
- DCreate a DynamoDB local secondary index (LSI) on the table. Use CustomerID as the partition
Explanation
The requirement is to query records by CustomerID, which is not the current partition key To achieve this efficiently: A Global Secondary Index (GSI) allows developers to create a different partition key and optional sort key for querying the data. By creating a GSI with CustomerID as the partition key, the developer can query the table efficiently using CustomerID as the primary lookup key. This avoids scanning the entire table and matches the requirement.
Community Discussion
No community discussion yet for this question.