kewur
kewur

Reputation: 491

Does using "limit" on Query consume read capacity on DynamoDB

Let's say I have a SortKey of "TimeUpdated". If I wanted to get the latest update with a Query for "LT" with UtcNow plus the PartitionKey with a Limit = 1, Do I expect read capacity to be counted towards only one item?

Upvotes: 0

Views: 841

Answers (1)

Nadav Har'El
Nadav Har'El

Reputation: 13731

Yes, if you use a KeyConditionExpression in the way you describe (and not use FilterExpression), then indeed you pay only for the item you retrieve.

However, note that as usual in DynamoDB's RCU calculation, the item size is rounded up to 4KB. So even if you read a single 100 byte item, you will still pay for a full 4KB.

Upvotes: 2

Related Questions