AWS DynamoDB Scan operation illustrated

Greg
2 min readFeb 12, 2023

Hello everyone, the purpose of this blog post is to illustrate how a “scan” operation in DynamoDB works.

Here is the big picture:

DynamoDB Scan operation

In this scenario, a client is making a scan request to a DynamoDB table.

In the scan operation, an optional limit parameter can be used which is the case here (value is set to 7).
The important thing to understand with a scan operation is that multiple requests might be needed to scan an entire table.

Here the scan operation will stop after the first 7 items.
In this scan operation, the client also passed an optional filter expression (value is not specified here, but it could be based on some attributes).
It means that the 7 items will be filtered before being sent back to the client (the filter is on the server side).

The client will receive only X items (3 in that case) because of the filter expression.
In the response, the ScannedCount is 7, the Count is 3.

A LastEvaluatedKey will also be sent back to the client so he can use that value as an ExclusiveStartKey in the next scan operation.

The SDKs and CLI can automate these multiple scan operations needed thanks to pagination.

More infos and details here:
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html

--

--