dynobase-icon
Dynobase

Question: How to count rows in DynamoDB?

Rafal Wilinski

Answered by Rafal Wilinski

Last updated: October 23rd, 2026

Answer

Use DescribeTable for an approximate item count, or a paginated Scan with Select: "COUNT" to count the items read. In DynamoDB, an item is the equivalent of a row; having several attributes does not make it several rows.

For a quick inventory count:

aws dynamodb describe-table --table-name Orders --query 'Table.ItemCount' --output text

AWS updates this metadata approximately every six hours, so it is unsuitable for a live business counter. It does not scan the table.

For an evaluated count, request Select: "COUNT" on each Scan page and add its Count. Continue with ExclusiveStartKey until LastEvaluatedKey is absent. ScannedCount counts items examined before filtering; Count counts the ones left after a filter. COUNT avoids returning item bodies but does not reduce read-capacity consumption.

Even a strongly consistent Scan does not provide a table-wide snapshot. If items change during pagination, the total may not represent the table at one instant. For repeatable historical reporting, count a point-in-time export. For frequent application counts, maintain a counter with carefully designed transactional or idempotent updates.

To count only one partition-key range, use Query with COUNT instead of scanning unrelated data. See pagination and Scan vs Query.

Source: AWS Scan API.

Dynobase is a Professional GUI Client for DynamoDB

Start your 7-day free trial today

Product Features

Download
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2026 Dynobase
+
Still using AWS DynamoDB Console?
Try Dynobase to accelerate your DynamoDB workflow. Start your 7-day free trial today.