Skip to content

Split the subgraph_deployment table into two #6003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

lutter
Copy link
Collaborator

@lutter lutter commented May 13, 2025

We split the table subgraphs.subgraph_deployment into two tables, subgraphs.head and subgraphs.deployment where the head table only contains the metadata that changes on every block.

This should help with situations where the subgraph_deployment table gets very bloated since the head table that gets bloated through frequent changes has much smaller rows than the current subgraph_deployment table. Rows in subgraph_deployment can grow as big as 500k, whereas rows in the head 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 that subgraph_deployment has.

This change has the downstream effect that there is no more sharded.subgraph_deployment table. Instead there are now sharded.head and sharded.deployment tables. This change will also require that all dashboards or other tools that used to access subgraph_deployment now access the two new tables.

Besides splitting tables, the new tables also use int4 columns throughout for block numbers rather than numeric since the rest of the system is restricted to int4 block numbers everywhere else.

@lutter lutter self-assigned this May 13, 2025
@lutter lutter requested a review from zorancv May 13, 2025 23:55
@lutter lutter force-pushed the lutter/split-sd branch from 49cd0e1 to c7a2b77 Compare May 14, 2025 00:02
@lutter lutter requested a review from encalypto May 14, 2025 00:02
@lutter lutter force-pushed the lutter/split-sd branch from c7a2b77 to 8e47a78 Compare May 14, 2025 00:41
lutter added 2 commits May 13, 2025 18:02
This also makes the timeouts used for IPFS requests configurable; the
default of 1s in debug builds is too short for the runner tests in CI and
we therefore set it to the 60s for release builds for those tests.
We split the table `subgraphs.subgraph_deployment` into two tables,
`subgraphs.head` and `subgraphs.deployment` where the `head` table only
contains the metadata that changes on every block.

This should help with situations where the `subgraph_deployment` table gets
very bloated since the `head` table that gets bloated through frequent
changes has much smaller rows than the current `subgraph_deployment`
table. Rows in `subgraph_deployment` can grow as big as 500k, whereas rows
in the `head` 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 that `subgraph_deployment` has.
@lutter lutter force-pushed the lutter/split-sd branch from 8e47a78 to 899b13a Compare May 14, 2025 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant