dynobase-icon
Dynobase

Error: DynamoDB scan does not return all items

Rafal Wilinski

Answered by Rafal Wilinski

Last updated: October 23rd, 2026

Solution

Scan does not return the whole table in one response. Each call evaluates up to 1 MB of data or the requested Limit, then applies filters. Continue with LastEvaluatedKey until it is absent or empty; raising Limit does not remove the page-size boundary.

import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, ScanCommand } from "@aws-sdk/lib-dynamodb";
const db = DynamoDBDocumentClient.from(new DynamoDBClient({ region: "us-east-1" }));
let cursor;
do {
  const page = await db.send(new ScanCommand({
    TableName: "Orders", ExclusiveStartKey: cursor
  }));
  for (const item of page.Items ?? []) console.log(item);
  cursor = page.LastEvaluatedKey;
} while (cursor && Object.keys(cursor).length);

Remove or correct a filter if you intended every item. For a parallel Scan, finish every segment and keep each segment’s cursor separate. Scanning a sparse GSI will not include base-table items that lack its keys.

A scan is not a transactionally consistent snapshot, even with ConsistentRead=true. Concurrent changes can affect what you observe. For repeated application reads, use a key-based Query where possible; for a point-in-time dataset, consider an export workflow instead.

See Scan pagination and AWS documentation.

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.