Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DynamoDB count operation capacity units consumption

If I'm not mistaken, to perform a count of items, in DynamoDB we have to use the query action and provide Select: 'COUNT' as parameter. Let's consider that I'd like to count the number of items that have a certain partition key. Given that we have to use the query action, does that mean the following?:

  1. Even though we're returning only the count, the consumed read capacity units will correspond to the size of all the items with that partition key.
  2. If the size of the items that have the given partition key exceeds 1MB, the count will be partial, will only consider the items up to 1MB and the operation will be paginated.
like image 400
davids Avatar asked Jun 07 '16 11:06

davids


1 Answers

The answer is yes, to both your questions.

That is apparent from these two points from the documentation:

  • Distinction between Count and ScannedCount:

If you used a QueryFilter in the request, then Count is the number of items returned after the filter was applied, and ScannedCount is the number of matching items before the filter was applied.

If you did not use a filter in the request, then Count and ScannedCount are the same.

  • The fact that DynamoDB looks at Count as just another attribute that can be returned:

You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.

like image 186
ketan vijayvargiya Avatar answered Oct 20 '22 03:10

ketan vijayvargiya