Pagination

Learn what pagination is and how to optimize queries to retrieve a huge amount of information without affecting performance.

There are times when the amount of information returned by DynamoDB is very large. That is why it isn’t advisable to obtain all that information in a single call. Doing this could be risky, because it could cause failures and adversely affect everything in a system. For this reason, it’s advisable to split the information into blocks called pages. In this lesson, we’re going to review what pagination is in DynamoDB.

What is pagination?

Pagination a functionality that allows you to receive fixed-size blocks with the information you want to retrieve from a database. This allows chunks of information to be received by making several sequential calls to an API.

How does pagination work in DynamoDB?

In DynamoDB, it’s possible to implement pagination in a very simple way. For this, it’s important to know three key concepts. These are exclusiveStartKey, lastEvaluatedKey, and queryPageSize. Before going any further, it’s important to remember that the restriction of only being able to receive a maximum of 1 MB of information applies here as well.

To better understand how pagination works in DynamoDB and the important concepts mentioned earlier, let’s look at the following image to understand the workflow:

Get hands-on with 1200+ tech skills courses.