Commit Graph
1 Commits
Author SHA1 Message Date
bvandeusenandClaude Opus 5.5 efba891f5e perf(8190): the exact search reads vectors from the row and text only for the winners
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / TypeScript typecheck (push) Successful in 33s
CI & Build / Python tests (push) Successful in 2m7s
CI & Build / integration (push) Failing after 2m15s
CI & Build / Build & push image (push) Skipped
Step 1 of milestone 669 "Knowledge reaches every project, work stays in its
own: a fast exact search, cross-project recall ranked and labelled", for
#6834 "auto_inject p90 latency has climbed since 10-23".

A search with no project in scope took about 1 s, because it ranked about
26k chunks exactly. Two costs on that path, neither of which changes a result:

- pgvector's vector type defaults to EXTERNAL storage, and a chunk row
  (about 1.5 KB of vector plus its text) is over the 2 KB toast threshold,
  so every vector sat in TOAST and each distance paid a lookup (151k buffer
  hits for 26k rows). Migration 0139 sets STORAGE MAIN on the four
  embedding tables and rewrites the existing rows once.
- The materialized scope carried every chunk's text beside its distance and
  spilled the sort to disk. It now carries the id, chunk index and distance,
  and the text is joined back for the rows that survive the cut.

Measured on the live corpus: 1,151 ms as before, 393 ms with the text out of
the scope, before the storage change.

The HNSW index stays out of the ranking. With pgvector 0.8's iterative
scan it returned 7 to 60 of the true 144 nearest chunks under a narrow
scope, at every setting tried.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 16:10:00 -05:00