Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typo, lint fix and added details for integers vs strings #578

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading