Advice on Optimizing Subgraph Performance

Hello Community,

I am relatively new to developing subgraphs on The Graph and have been facing performance issues lately.
Particularly, I am looking for tips on optimizing my subgraph’s query efficiency and reducing indexing time.
Any insights or best practices would be greatly appreciated!


1 Like

You can read more about it here
Also this

1 Like


there are 3 things we highly recommend to do. This will improve your indexing and querying performance.

  1. Change type of id in entities to Bytes . As, type ID takes twice the space of Bytes and comparison of strings in Bytes is much cheaper than in type ID .

  2. Mark immutable for entities whenever possible. When entity types are marked as immutable,
    graph-node uses database indexes that are much cheaper to build and maintain than mutable entities.
    Please check out this detailed blog: Two Simple Subgraph Performance Improvements | Blog | The Graph

  3. You can also reduce eth_calls to improve indexing performance
    More detailed information here - Improve Subgraph Indexing Performance Easily: Reduce eth_calls | Blog | The Graph


I highly recommend watching the latest Indexer Office Hours session about “Query caching and performance.” You can find it at the following link

1 Like

Thanks @0x_yasshh

I studied all the resources you provided, it is really helpful. Now I have found the solution to my query regarding subgraph performance.

Thanks again

1 Like

Thanks @pilar for providing this video link.

1 Like