mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-07-29 07:14:56 +00:00
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>