A developer is building a digital concert ticketing application. The application needs to retrieve ticket status details for a single ticket using the TicketId, which is the partition key of the Amazon DynamoDB table. The developer wants to minimize latency and read capacity consumption. Which approach is the most efficient and cost-effective way to retrieve the ticket details?
- Use the GetItem API operation specifying the exact TicketId value.Cevap
- BUse the Scan API operation with a FilterExpression to match the TicketId.
- CIncrease the provisioned read capacity units (RCUs) and use the Scan API operation.
- DConfigure the AWS SDK client with hardcoded credentials and run a Scan operation.
Cevap
Use the GetItem API operation specifying the exact TicketId value.
Using the GetItem operation is the most efficient method because it retrieves a single item directly by its primary key (TicketId) without reading any other items in the table, resulting in the lowest latency and resource consumption.
Adım Adım Çözüm
Anahtar Kavram
Single-item lookup using the GetItem API operation is the most efficient way to retrieve data by primary key in DynamoDB.