Reputation: 5
I read that dynamo db scan operation is slow when the data is large . but i want to know that, Having a scenario to extract all the items. Is it still preferred to avoid scan ? considering indexes are not free and i need all the items from table, i am going for this approach.
Upvotes: 0
Views: 1573
Reputation: 23783
If you need all items, then Scan() is perfectly fine.
Just realize that DDB
ExclusiveStartKey
:= LastEvaluatedKey
The recommendation against Scan() is trying to use Scan() + filter in place of Query() for a subset of records. Scan() always reads the full table.
Also note that from a performance standpoint, Scan() supports parallel scans.
TotalSegments
For a parallel Scan request, TotalSegments represents the total number of segments into which the Scan operation will be divided. The value of TotalSegments corresponds to the number of application workers that will perform the parallel scan. For example, if you want to use four application threads to scan a table or an index, specify a TotalSegments value of 4.
But again, if using provisioned reads...a parallel scan will eat up RCU quickly.
Upvotes: 1