Skip to content

Commit

Permalink
Add clarification for term history in indexerHInts docs
Browse files Browse the repository at this point in the history
  • Loading branch information
incrypto32 committed Feb 2, 2024
1 parent a2070ed commit cc18d32
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion website/pages/en/developing/creating-a-subgraph.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ repository: https://github.com/graphprotocol/graph-tooling
schema:
file: ./schema.graphql
indexerHints:
historyBlocks: min
prune: auto
dataSources:
- kind: ethereum/contract
name: Gravity
Expand Down Expand Up @@ -163,8 +163,26 @@ The important entries to update for the manifest are:
prune: auto
```
> The term "history" in this context of subgraphs is about storing data that reflects the old states of mutable entities. This capability is essential for [time travel queries](/querying/graphql-api/#time-travel-queries), which permit the examination of previous states of these entities at particular points in the blockchain's history.
Using `"auto"` is generally recommended as it maximizes query performance and is sufficient for most users who do not require access to extensive historical data.
For subgraphs leveraging [time travel queries](/querying/graphql-api/#time-travel-queries), it's advisable to either set a specific number of blocks for historical data retention or use `prune: never` to keep all historical entity states. Below are examples of how to configure both options in your subgraph's settings:
To retain a specific amount of historical data:
```
indexerHints:
prune: 1000 # Replace 10000 with the desired number of blocks to retain
```
To preserve the complete history of entity states:
```
indexerHints:
prune: never
```
- `dataSources.source`: the address of the smart contract the subgraph sources, and the ABI of the smart contract to use. The address is optional; omitting it allows to index matching events from all contracts.
- `dataSources.source.startBlock`: the optional number of the block that the data source starts indexing from. In most cases, we suggest using the block in which the contract was created.
Expand Down

0 comments on commit cc18d32

Please sign in to comment.