Question: 1/50
A retail application uses Amazon DynamoDB to store shopping cart items keyed by customerId (partition key) and createdAt (sort key). The application must retrieve the most recent cart items for a customer with minimal latency. Which design is the MOST appropriate?
Query the table using the customerId partition key and set ScanIndexForward=false to return items in descending sort key order
Scan the table with a filter expression on customerId and sort the results client-side by createdAt
Create a global secondary index (GSI) with createdAt as the partition key and customerId as the sort key, then query it
Use BatchGetItem for all possible createdAt values and filter client-side