Page the results
The Output Module also supports paging the results for the root node of the query. You can specify an offset and a length parameter to limit the results to a subset of the complete list.
displayStart
0
The offset in the list of results. This offset is a zero-based index value.
displayLength
-1
The maximum total number of results to return. A negative value means unlimited.
maxCountLimit
-1
The maximum count value. A count of all records can lead to performance problems. When paging, you can limit the max count to this value. Passing 0 means no count is done.
{
"ViewConfig": {
"displayStart": 10,
"displayLength": 5,
"maxCountLimit": 10000,
"Resources": {
"Community": {
"Id": { "name": "communityId" },
"Name": { "name": "communityName" },
"Description": { "name": "communityDescription" },
"Order": [ { "Field": { "name": "communityName", "order": "ASC" } } ]
}
}
}
}---
ViewConfig:
displayStart: 10
displayLength: 5
maxCountLimit: 10000
Resources:
Community:
Id:
name: "communityId"
Name:
name: "communityName"
Description:
name: "communityDescription"
Order:
-
Field:
name: "communityName"
order: "ASC"The example query above selects page 3 of all communities, with five results per page.
Cursor-based pagination
Offset-based pagination does not scale for a big data set. The bigger the offset, the slower the response time. For a bulk export of many assets, it's better to use cursor-based pagination:
Run the initial query sorting by ID. This is the recommended option to achieve maximum performance. Use a medium page size, such as 10,000.
Read the results and keep the last ID value.
Pass this ID as a filter to the next query.
Repeat the process until the number of returned results is less than the page size. This means you retrieved all data.
Last updated
Was this helpful?