DynamoDB interview question · Most asked

How does pagination work in DynamoDB?

Summary

Query and Scan return at most 1 MB of data per call (before filtering), plus LastEvaluatedKey when there is more. Pass it as ExclusiveStartKey in the next request. Limit caps the number of items evaluated per page.

Longer Answer

Implications:

  • A page can contain fewer items than Limit, or even zero items with a LastEvaluatedKey, when a filter expression removes items; keep paging until the key is absent.
  • API cursors are usually the encoded LastEvaluatedKey (encrypt or sign it so clients cannot tamper with it).
  • There is no "jump to page N"; DynamoDB pagination is cursor-based by nature.
  • SDK paginators handle the loop for you.

Key Points

  • 1 MB per page; LastEvaluatedKey to continue.
  • Filters can produce short or empty pages.
  • Cursor-based only.
  • Sign cursors exposed to clients.

More most-asked DynamoDB questions

← All DynamoDB questions