Skip to content

Commit ef7bd37

Browse files
committed
minor fixes
1 parent 0b3495a commit ef7bd37

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

website/pages/en/cookbook/sorting.mdx

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ title: GraphQL Sorting Strategies
44

55
## Sort by IDs
66

7-
When creating subgraphs in The Graph, it's important to consider the type of ID used for your entities. This choice can have a significant impact on the performance and ease of use of your subgraph.
7+
When creating subgraphs in The Graph, it's important to use Bytes! as ID for your entities. This can have significant impact on the performance and ease of use of your subgraph.
88

9-
If accurate sorting is desired, both Strings and Bytes for IDs are not optimal as the sorting is done non-sequentially which can lead to unexpected results. If attempting to sort by id of type "ID" (which is a string), the ordered sequence might look like this:
9+
Unless for cases like nft traits or unique names where a type ID (which is a string) would be more appropriate.
10+
11+
If accurate sorting of numerical values is desired, both Strings and Bytes for IDs are not optimal as the sorting is done non-sequentially which can lead to unexpected results. If attempting to sort by id of type "ID" (which is a string), the ordered sequence might look like this:
1012

1113
schema.graphql:
1214

@@ -116,7 +118,7 @@ Query Response:
116118
}
117119
```
118120

119-
## Ideal Sorting Strategy of IDs
121+
## Ideal Sorting for Numerical Values
120122

121123
To improve the sorting, creating another property on the entity that is a BigInt (in this example it is tokenId) will allow for sorting to be optimized sequentially.
122124

0 commit comments

Comments
 (0)