Skip to content

Maintain graph adjacency table incrementally during ingestion. - #1936

Draft
apognu wants to merge 1 commit into
feat/graph-walking-v2from
feat/incremental-graph-building
Draft

Maintain graph adjacency table incrementally during ingestion.#1936
apognu wants to merge 1 commit into
feat/graph-walking-v2from
feat/incremental-graph-building

Conversation

@apognu

@apognu apognu commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

_graph was previously refreshed only by a periodic full rebuild (default 24h), so a record ingested right after a build was invisible to graph walks until the next cycle.

Now we upsert into the table inside the existing ingestion transaction, behind a subtransaction so a failure never fails ingestion itself. Retraction covers a field an ingested version leaves null/empty, which the upsert cannot express since the table has no valid_until.

Rework the periodic build's swap to rename the live table aside instead of dropping it, so records ingested while a build is running are reconciled from the previous generation after the swap rather than replayed under a lock that graph read queries would otherwise block on.

@apognu
apognu force-pushed the feat/incremental-graph-building branch from db62509 to 8d91fd4 Compare August 19, 2026 08:20
@apognu
apognu force-pushed the feat/incremental-graph-building branch from 8d91fd4 to 803dd37 Compare August 26, 2026 10:53
@apognu
apognu force-pushed the feat/incremental-graph-building branch from 803dd37 to 46d6a4f Compare August 26, 2026 10:58
@apognu
apognu force-pushed the feat/incremental-graph-building branch from 46d6a4f to 55ebe36 Compare August 27, 2026 12:39
`_graph` was previously refreshed only by a periodic full rebuild (default
24h), so a record ingested right after a build was invisible to graph
walks until the next cycle.

Now we upsert into the table inside the existing ingestion transaction,
behind a subtransaction so a failure never fails ingestion itself. Retraction
covers a field an ingested version leaves null/empty, which the upsert
cannot express since the table has no valid_until.

Rework the periodic build's swap to rename the live table aside instead
of dropping it, so records ingested while a build is running are reconciled
from the previous generation after the swap rather than replayed under a lock
that graph read queries would otherwise block on.
@apognu
apognu force-pushed the feat/incremental-graph-building branch from 55ebe36 to 43dd7aa Compare August 27, 2026 12:45
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