-
Notifications
You must be signed in to change notification settings - Fork 145
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
Subgraph Best Practices 5 and 6 #825
base: main
Are you sure you want to change the base?
Conversation
... and added links to bottom of each best practice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are terrific! Great explanations @marcusrein 🔥
@@ -100,3 +100,17 @@ Note: Declared eth_calls can only be made in subgraphs with specVersion >= 1.2.0 | |||
## Conclusion | |||
|
|||
We can significantly improve indexing performance by minimizing or eliminating `eth_calls` in our subgraphs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can significantly improve indexing performance by minimizing or eliminating `eth_calls` in our subgraphs. | |
You can significantly improve indexing performance by minimizing or eliminating `eth_calls` in your subgraphs. |
|
||
## Subgraph Best Practices 1-6 | ||
|
||
1. [Improve Query Speed with Subgraph Pruning](https://thegraph.com/docs/en/cookbook/pruning/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All
1. [Improve Query Speed with Subgraph Pruning](https://thegraph.com/docs/en/cookbook/pruning/) | |
1. [Improve Query Speed with Subgraph Pruning](/cookbook/pruning/) |
You should make this modification to all links
@benface correct me if I'm wrong here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Links that are within the docs*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because absolute links have the language (English) hardcoded in them, whereas relative ones keep the current language (and the href
is copied over as-is to translated pages).
@@ -71,3 +71,17 @@ This will not only make our subgraph more efficient, but it will also unlock thr | |||
Adopting the `@derivedFrom` directive in subgraphs effectively handles dynamically growing arrays, enhancing indexing efficiency and data retrieval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adopting the `@derivedFrom` directive in subgraphs effectively handles dynamically growing arrays, enhancing indexing efficiency and data retrieval. | |
Use the `@derivedFrom` directive in subgraphs to effectively manage dynamically growing arrays, enhancing indexing efficiency and data retrieval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you didn't edit this section, but adding it your PR since you edited these pages 😉
@@ -71,3 +71,17 @@ This will not only make our subgraph more efficient, but it will also unlock thr | |||
Adopting the `@derivedFrom` directive in subgraphs effectively handles dynamically growing arrays, enhancing indexing efficiency and data retrieval. | |||
|
|||
To learn more detailed strategies to avoid large arrays, read this blog from Kevin Jones: [Best Practices in Subgraph Development: Avoiding Large Arrays](https://thegraph.com/blog/improve-subgraph-performance-avoiding-large-arrays/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To learn more detailed strategies to avoid large arrays, read this blog from Kevin Jones: [Best Practices in Subgraph Development: Avoiding Large Arrays](https://thegraph.com/blog/improve-subgraph-performance-avoiding-large-arrays/). | |
For a more detailed explanation of strategies to avoid large arrays, check out Kevin Jones' blog: [Best Practices in Subgraph Development: Avoiding Large Arrays](https://thegraph.com/blog/improve-subgraph-performance-avoiding-large-arrays/). |
|
||
## TLDR | ||
|
||
Grafting is a powerful feature in subgraph development that allows you to build and deploy new subgraphs while reusing the indexed data from existing ones. This technique is particularly useful for quickly deploying hotfixes to address critical issues without the need to re-index the entire subgraph from scratch. By preserving historical data, grafting ensures minimal downtime and maintains continuity in data services. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grafting is a powerful feature in subgraph development that allows you to build and deploy new subgraphs while reusing the indexed data from existing ones. This technique is particularly useful for quickly deploying hotfixes to address critical issues without the need to re-index the entire subgraph from scratch. By preserving historical data, grafting ensures minimal downtime and maintains continuity in data services. | |
## TLDR | |
Grafting is a powerful feature in subgraph development that allows you to build and deploy new subgraphs while reusing the indexed data from existing ones. | |
### Overview | |
This feature enables quick deployment of hotfixes for critical issues, eliminating the need to re-index the entire subgraph from scratch. By preserving historical data, grafting minimizes downtime and ensures continuity in data services. |
To break up for quick readability 😃
|
||
## Why Timeseries and Aggregations Are a Best Practice | ||
|
||
1. Improved Indexing Time • Less Data to Load: Mappings handle less data since raw data points are stored as immutable timeseries entities. • Database-Managed Aggregations: Aggregations are automatically computed by the database, reducing the workload on the mappings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing issue that's distorting the formatting. I think the bullet point are suppose to be below the numbers, right?
- first | ||
- last | ||
|
||
The arg in @aggregate can be: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it should be a subheading
- A field name from the timeseries entity. | ||
- An expression using fields and constants. | ||
|
||
Examples of Aggregation Expressions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also seems like a subheading
|
||
### Important Considerations | ||
|
||
- Immutable Data: Timeseries data cannot be altered once written, ensuring data integrity and simplifying indexing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be useful to place this closer to the top bc it strikes me as a warning
|
||
## How to Implement Timeseries and Aggregations | ||
|
||
### Defining Timeseries Entities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a hierarchy to all the headings underneath? They're all level 3 headings, so just double checking 😄
Added
Subgraph Best Practice 5
andSubgraph Best Practice 6
after peer review process was completed.Updated formatting and added links to the bottom of each Subgraph Best Practice as well to improve congruency of this cookbook series.
Thanks!