Files
paperless-ngx/src
stumpylogandClaude Sonnet 5 feac526318 Perf: count compact()'s live rows via document_chunks, not a vec0 scan
compact() ran SELECT count(*) on the vec0 table itself purely to compute
the bloat ratio, on every update_llm_index() call -- including small
scoped ones from bulk_update_documents. Like any other document_id-scale
lookup, count(*) has no point-lookup fast path on vec0's own table, so
this is a full scan regardless of index size.

document_chunks is kept in lockstep with the vec0 table by construction
and is a plain indexed table, so it gives an identical count far more
cheaply. Only affects the bloat-ratio heuristic and a log line -- the
actual rebuild already streams and counts real vec0 rows independently
(_copy_rows()'s own return value), so this can't desync compaction's
correctness even in the brief window before a store's document_chunks is
fully backfilled by migration.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-28 15:36:42 -07:00
..
2026-07-27 20:14:39 -07:00
2023-04-26 09:35:27 -07:00