If a client needs to retrieve a large number of entities, it is much more performant to base queries on an attribute and filter by that attribute. For example, a client would retrieve a large number of tokens using this query:
A typical technique for getting huge amounts of data from a server is cursor-based pagination. It enables a client to "page" through the remaining data as necessary while retrieving a portion of the data at a time. Especially if the data set is enormous, this is frequently more effective than obtaining all of the data at once.
The server normally provides a set of arguments that can be used to specify the "cursor" for the current page of results and the number of items to include on each page in order to perform cursor-based pagination in a GraphQL API. For instance, you may define the number of items to display on the current page and the cursor for using the first and after options.
It is frequently helpful to offer filters that may be used to reduce the results based on particular criteria in addition to these pagination options. For instance, a client might want to only return entities that are greater than or less than a specified value, or those that contain a certain attribute value. The server can provide arguments like where or orderBy that let the client specify filter criteria to facilitate these kinds of queries.
query MyQuery($lastID: String) {
badges(first: 5000, where: { id_gt: $lastID }) {
id
owner
}
}