Pagination
The SDK (and API) expose the ability to request a specific page of the result set by providing both a page number and a dynamically set page size (this means you control the page size).
By default the page size is set to 100,000 rows and, the page number is set to 1. If you don't set the page size and just use the default, always remember to check page stats in case the number of rows in the entire query result set exceeds the default page size. In this case, you'd need to use the pagination examples on this page to gather your complete result set. Also, keep in mind that there is a byte limit on the amount of data that can be returned on a single page. There may be cases where 100,000 rows are too big and you will need to decrease the page size to a lower number. More details on rate limits around page sizing here.
Let's start with the following query to return the last 50k NFT transfers on Ethereum:
First, we execute the query.
Since we know that we are going to page thru the result set after the execution of the query we set the page number and page size to 1 so that we don't attempt to return a very large data set all at once.
After executing the query we can request pages of the results. In this example, we'll specify a page size of 10,000 rows per request.
In the above example, we use the page
property of the query result set to determine how many pages exist given a page size of 1000 rows. While in this case, we know there is an upper limit of 50k rows, this is particularly useful when we don't know the total number of rows returned by a query in advance.
In the next section, we'll walk thru how to sort your results.
Last updated