The scan operation in DynamoDB is used to retrieve and filter the data from the table. The scan operation scans all the items from the table and returns only those items that meet the filtering criteria. To filter items, we have to provide the conditions in which the filtering should take place, in the FilterExpression parameter in the request header.
If the scan operation does not match any items in the table, it will return the empty result set.
Also, if the scan operation result exceeds 1 MB, the scan will stop and the result returned will be LastEvaluatedKey. With this key, we can continue with the scan operation again and get the subsequent data.
We can paginate data if it exceeds the 1 MB limit, using LastEvaluatedKey to paginate other pages of data. We can read all of the data using pagination even if we are limited to 1 MB data at a time. However, we can also perform a parallel scan on the large table to achieve fast performance.
To perform a parallel scan, we have to provide the Segment and TotalSegment parameters.
The following code shows the syntax:
{
"TableName":"String",
"FilterExpression":"String",
"Select":"String",
"Segment":number,
"TotalSegment":number,
.
.
}.