You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/src/pages/en/subgraphs/querying/subgraph-id-vs-deployment-id.mdx
+28-1Lines changed: 28 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,15 @@
2
2
title: Subgraph ID vs Deployment ID
3
3
---
4
4
5
+
Managing and accessing Subgraphs relies on two distinct identification systems: Subgraph IDs and Deployment IDs.
6
+
5
7
A Subgraph is identified by a Subgraph ID, and each version of the Subgraph is identified by a Deployment ID.
6
8
7
9
When querying a Subgraph, either ID can be used, though it is generally suggested that the Deployment ID is used due to its ability to specify a specific version of a Subgraph.
8
10
9
-
Here are some key differences between the two IDs: 
11
+
Both identifiers are accessible in [Subgraph Studio](https://thegraph.com/studio/):
12
+
13
+

10
14
11
15
## Deployment ID
12
16
@@ -18,10 +22,33 @@ Example endpoint that uses Deployment ID:
Using Deployment IDs for queries offers precise version control but comes with specific implications:
26
+
27
+
- Advantages: Complete control over which version you're querying, ensuring consistent results
28
+
- Challenges: Requires manual updates to query code when new Subgraph versions are published
29
+
- Use case: Ideal for production environments where stability and predictability are crucial
30
+
21
31
## Subgraph ID
22
32
23
33
The Subgraph ID is a unique identifier for a Subgraph. It remains constant across all versions of a Subgraph. It is recommended to use the Subgraph ID to query the latest version of a Subgraph, although there are some caveats.
24
34
25
35
Be aware that querying using Subgraph ID may result in queries being responded to by an older version of the Subgraph due to the new version needing time to sync. Also, new versions could introduce breaking schema changes.
26
36
27
37
Example endpoint that uses Subgraph ID: `https://gateway-arbitrum.network.thegraph.com/api/[api-key]/subgraphs/id/FL3ePDCBbShPvfRJTaSCNnehiqxsPHzpLud6CpbHoeKW`
38
+
39
+
Using Subgraph IDs comes with important considerations:
40
+
41
+
- Benefits: Automatically queries the latest version, reducing maintenance overhead
42
+
- Limitations: May encounter version synchronization delays or breaking schema changes
43
+
- Use case: Better suited for development environments or when staying current is more important than version stability
0 commit comments