Split the subgraph_deployment table into two #6003
Open
+696
−327
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We split the table
subgraphs.subgraph_deployment
into two tables,subgraphs.head
andsubgraphs.deployment
where thehead
table only contains the metadata that changes on every block.This should help with situations where the
subgraph_deployment
table gets very bloated since thehead
table that gets bloated through frequent changes has much smaller rows than the currentsubgraph_deployment
table. Rows insubgraph_deployment
can grow as big as 500k, whereas rows in thehead
table will only take about 350 bytes at most.Updates will also be marginally better on the
heads
table since it only has one index rather than the two thatsubgraph_deployment
has.This change has the downstream effect that there is no more
sharded.subgraph_deployment
table. Instead there are nowsharded.head
andsharded.deployment
tables. This change will also require that all dashboards or other tools that used to accesssubgraph_deployment
now access the two new tables.Besides splitting tables, the new tables also use
int4
columns throughout for block numbers rather thannumeric
since the rest of the system is restricted toint4
block numbers everywhere else.