Skip to content

Commit

Permalink
Added querying by subgraph id vs deployment id page (#555)
Browse files Browse the repository at this point in the history
* Added querying by subgraph id vs deployment id page

* Update website/pages/en/querying/querying-by-subgraph-id-vs-deployment-id.mdx

+1

Co-authored-by: Benoît Rouleau <benoit.rouleau@icloud.com>

* Update website/pages/en/querying/querying-by-subgraph-id-vs-deployment-id.mdx

+1

Co-authored-by: Benoît Rouleau <benoit.rouleau@icloud.com>

---------

Co-authored-by: Benoît Rouleau <benoit.rouleau@icloud.com>
  • Loading branch information
marcusrein and benface authored Jan 8, 2024
1 parent 84e1b43 commit f3f26e8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Subgraph ID vs Deployment ID
---

A subgraph is identified by a Subgraph ID, and each version of the subgraph is identified by a Deployment ID.

When querying a subgraph, either ID can be used. However, there are some important differences between the two options.

![](/img/subgraph-id-vs-deployment-id.png)

## Subgraph ID

The Subgraph ID is a unique identifier for a subgraph. It remains constant across all versions of a subgraph. When queries are made using the Subgraph ID, you are not specifying a version. This means that the version of the subgraph that responds to your query may not be the latest version. Rather, it will be the most recent version that is synced and healthy.

Example endpoint that uses Subgraph ID:

`https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/FL3ePDCBbShPvfRJTaSCNnehiqxsPHzpLud6CpbHoeKW`

## Deployment ID

When you're viewing a deployed subgraph, previously deployed versions are available for selection. Each version in that list has a unique Deployment ID.

When you make queries using the Deployment ID, you are specifying a version of that subgraph to query. This means that the version of the subgraph that responds to your query will be the version specified by the Deployment ID.

Example endpoint that uses Deployment ID:

`https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/QmfYaVdSSekUeK6expfm47tP8adg3NNdEGnVExqswsSwaB`

## Considerations When Using Subgraph ID vs Deployment ID

If you want to ensure that the latest version of your subgraph responds to your queries, you should use the Deployment ID. This requires you to update the Deployment ID in your frontend whenever you publish a new version of your subgraph.

If you want to ensure you are querying a specific version of your subgraph, you should also use Deployment ID.

If you do not need to ensure that the latest version of your subgraph always responds to your queries, you can use the Subgraph ID. However, be aware that this may result in your queries being responded to by an older version of your subgraph.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f3f26e8

Please sign in to comment.