Skip to content

Commit

Permalink
typo, lint fix and added details for integers vs strings
Browse files Browse the repository at this point in the history
  • Loading branch information
kmjones1979 committed Jan 12, 2024
1 parent bb5a611 commit 0bbcc28
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions website/pages/en/querying/graphql-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,22 @@ Query 10 `Token` entities, offset by 10 places from the beginning of the collect
}
```

#### Example using `first` and `id_ge`
#### Example using `first` and `_gt`

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:

```graphql
query manyTokens($lastID: String) {
tokens(first: 1000, where: { id_gt: $lastID }) {
id
tokens(first: 1000, where: { tokenId_gt: $lastID }) {
token_Id
owner
}
}
```

The first time, it would send the query with `lastID = ""`, and for subsequent requests would set `lastID` to the `id` attribute of the last entity in the previous request. This approach will perform significantly better than using increasing `skip` values.
The first time, it would send the query with `lastID = ""`, and for subsequent requests would set `lastID` to the `token_Id` attribute of the last entity in the previous request. This approach will perform significantly better than using increasing `skip` values.

It is important to mention that the works best when filtering based on an entity that is defined as an integer in the schema. You might get unexpected results from strings.

### Filtering

Expand Down

0 comments on commit 0bbcc28

Please sign in to comment.