Repository navigation
Containment recall reads indexes instead of scanning the base - #12
Merged
Merged
Conversation
…kup, names by a trigram index, and the reverse branch by the mention's own substrings. Signed-off-by: Bogdan Szabo <[email protected]>
gedaiu
force-pushed
the
perf/containment-trgm
branch
from
October 19, 2026 10:58
01cfdfa to
91f93fa
Compare
gedaiu
marked this pull request as ready for review
October 19, 2026 10:58
This was referenced Oct 19, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Depends on #10 (migration 9001
facts_live_predicate_idx); this branch is built on its head, so merge #10 first, then this shows only its own commit.Lore's memory mirror pushes prose to
apisources, and every new name in it runscontainment_reviews. On prod (re-cinq/lore base: 39k entities, 39k alias facts, 960k facts) that took 1.1 s per call, 833 ms of it JIT; 25 at once pinned the DB at 4 CPU.SET LOCAL jit = offfor the query.pg_trgm+ a GIN trigram index on live entity names for the forwardLIKE '%mention%'branch.mention LIKE '%name%') matches the mention's own substrings (≥MIN_CONTAIN_CHARS) by equality on existing btree indexes: same semantics, no escaping needed.Seeded base of production shape, jit off: 72 ms → 15 ms for a name with no hits, 73 → 60 ms for one with 3,900. A trigram index on all facts was faster for rare names but slower for common ones, 55 MB and on the write path, so it is left out. New tests:
contained_namesunits, and the Mr. Holmes ↔ Sherlock Holmes alias pairing. fmt, clippy andcargo test --workspacegreen. Schema version 104 → 105; renumber if #10 changes.Fork only for now; upstream deeplethe#1104 / deeplethe#1322 rewrite this predicate, noted in the code for the next sync.