Skip to content

The evidence of a chunk is found by an index - #79

Merged
gedaiu merged 1 commit into
re-devfrom
re/fact-evidence-chunk-index
Nov 24, 2026
Merged

gedaiu merged 1 commit into
re-devfrom
re/fact-evidence-chunk-index

Conversation

@gedaiu

@gedaiu gedaiu commented Nov 24, 2026

Copy link
Copy Markdown

fact_evidence is indexed by (fact_id, chunk_id) and by document_id, so every query that joins it to chunks on chunk_id (the cited-facts read on document delete in documents.rs, and about twenty others) planned a parallel scan of the whole table. On the internal cluster that is 11.4M rows a call, 217,939 scans so far and the query most often seen running. Migration 9013 adds fact_evidence_chunk_idx on (chunk_id), built inside the migration transaction like 0122.

🤖 Generated with Claude Code

… longer scans all of fact_evidence

Signed-off-by: Bogdan Szabo <bogdan@re-cinq.com>
@gedaiu
gedaiu merged commit 17e65ce into re-dev Nov 24, 2026
7 checks passed
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