Search⌘ K

Overview of Pagination

Explore how Cosmos DB handles pagination by dividing query results into pages using MaxItemCount and continuation tokens. Understand automatic and manual pagination methods, their features, and limitations including effects on query results and compatibility with GROUP BY and DISTINCT clauses. This lesson helps you manage large query results and optimize data retrieval in distributed databases.

Introduction

Pagination divides a set of results into pages returned separately. In most cases, Cosmos DB determines when to paginate the results. Let’s start with the only way we can control it. When we query the database, we can use the MaxItemCount option to limit the number of items returned. For example, if the query response contains 100 items, and we set the limit to 20, there will be five pages.

The other causes of pagination are the following:

    ...