Scan
Parameters
When you use the
--limitparameter with thescanoperation in DynamoDB and set it to 5, it indeed instructs DynamoDB to evaluate only the first 5 items in the table.Without
--filter: If you set--limit 5without a filter, DynamoDB evaluates the first 5 items and returns them as the result of the scan.With
--filter: If you set--limit 5and also specify a--filterexpression, DynamoDB still evaluates the first 5 items. However, it only returns those that match the filter criteria. If fewer than 5 items match the filter, then fewer than 5 items are returned. If none of the first 5 items match the filter, it returns no items. In either case, it only evaluates 5 items before stopping.
The
page-sizeparameter will determine the number of items returned in each page of a query.If there are more items available than the specified
--max-itemsvalue, the response includes aNextTokenvalue.
Best practices
Avoid using scan operation on large table or index, use Filter --filter-expression and Projection --projection-expression , and --page-size to get specific data instead.

Trivia
1 single DynamoDB scan can retrieve max 1MB.
Last updated