Reading the cost of scanning a DynamoDB table

It is unclear after reading documents how many units of reading capacity are consumed during a scan operation with a filter in DynamoDB. For example, using this ruby โ€‹โ€‹query:

table.items.where(:MyAttribute => "Some Value").each do |item_data|
   # do something with the item_data
end

I understand that this will lead to a table scan, but DynamoDB will only return the items that interest me. But if my table contains 10,000 elements, and only 5 of these elements are what goes through my filter, am I still "charged" for a huge number of reading capacity units?

The attribute that I use for the filter is not a hash, range, or secondary index. I just had to add this attribute recently and unexpectedly, so I am not using the query instead.

+4
source share
1 answer

In short, you will be โ€œchargedโ€ for the total number of items scanned (and not the total amount of items returned). Scan compared to a query (as you mentioned) is an expensive operation.

It should be noted that when invoking a scan in a table, this does not mean that the entire table will be scanned. If the size of the scanned items exceeds the limit of 1 MB, scanning stops and you need to call it again to scan the next part of the table.

This is taken from official docs:

1 , LastEvaluatedKey . , . , .

, .

, , - .

+4

Source: https://habr.com/ru/post/1598841/


All Articles