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
checkEmbeddingVectorSamplesinsrc/cli/qmd.ts: fixed by #978maybeAdoptLegacyEmbeddingFingerprintinsrc/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 doctordoesn't stop it.bin/qmddoesn'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.
Source: tobi/qmd