#994·qmd

doctor hangs / fills disk on large indexes: per-chunk document-body materialization

Author: mjavertoCreated Sep 26, 2026Updated Sep 26, 2026

What happens

qmd doctor never finishes on big indexes.

  • 2.5.3: stuck at high CPU forever
  • 2.8.3: keeps writing a temp file to disk until you kill it

Why

Two doctor checks each need just 1 to 3 sample chunks. But their SQL reads the whole document text once per chunk, and again for every path that points to that document, before throwing almost all of it away.

  • A doc with 1,000 chunks gets read 1,000 times
  • Bigger docs have more chunks, so the cost grows much faster than the index does
  • The culprit in both queries: JOIN content c ... GROUP BY ..., c.doc

Where

  1. checkEmbeddingVectorSamples in src/cli/qmd.ts: fixed by #978
  2. maybeAdoptLegacyEmbeddingFingerprint in src/store.ts: only runs on older indexes (embeddings with no fingerprint). Fixed by #995

Related

  • #993 edits query 2 too, so it'll conflict with #995
  • timeout qmd doctor doesn't stop it. bin/qmd doesn't pass SIGTERM to the process it starts, so the stuck query keeps running (see #912, #923, #809)

Seen on qmd 2.5.3 and 2.8.3.