A developer is building a customer support ticketing portal. The application stores tickets in an Amazon DynamoDB table with `CustomerID` as the partition key and `TicketID` as the sort key. The developer needs to implement a dashboard view that displays all tickets with a status of `Open` across all customers, sorted by the date they were created. Which strategy should the developer use to retrieve this data with the lowest latency and minimal Read Capacity Unit (RCU) consumption?
- Create a Global Secondary Index (GSI) using Status as the partition key and CreatedAt as the sort key, and then perform a Query operation on the GSI.Answer
- BPerform a Scan operation on the base table using a FilterExpression to retrieve only the items where the Status attribute is equal to Open.
- CIncrease the provisioned read capacity units (RCUs) on the base table and use a Scan operation to handle the queries without throttling.
- DInitialize the AWS SDK client with hardcoded administrator credentials in the application source code to perform parallel scans.
Answer
Create a Global Secondary Index (GSI) using Status as the partition key and CreatedAt as the sort key, and then perform a Query operation on the GSI.
Creating a Global Secondary Index (GSI) with Status as the partition key and CreatedAt as the sort key allows the application to query all open tickets across all customers. A Query operation on the GSI reads only the items that match the key condition, minimizing Read Capacity Unit (RCU) consumption and reducing latency.
Step-by-Step Solution
Key Concept
Using a Global Secondary Index (GSI) to support query access patterns across all partition keys of a base DynamoDB table.
Estimated Time:1m 30s