QuestionQ52

VerifiedTroubleshooting and Optimization

An application includes an Amazon DynamoDB table that is named orders. The table has a primary partition key of id and a global secondary index (GSI) that is named an accountIndex. The GSI has a partition key of accountId and a sort key of orderDateTime.

A developer needs to create an AWS Lambda function to retrieve the orders that have an accountId of 100.

Which solution will meet this requirement by using the LEAST read capacity?

Explanation

The Query operation on a Global Secondary Index (GSI) with partition key accountId consumes the least read capacity because it retrieves only items matching that partition key. A Scan operation would read the entire index, consuming significantly more capacity. Query operations are always more efficient than Scan for targeted lookups.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!