Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Deletes leave tombstoned nodes in the graph (still traversed, filtered from results). Heavy churn bloats memory, slows queries, and degrades recall.
Imagine a phone book where every entry is connected by little arrows to a few similar entries. When someone moves out, you do not actually rip the page out (that would shred all the arrows pointing to that page and you'd have to redraw them). Instead, you put a sticker on their entry that says 'gone'. People searching the phone book still wander past their entry, follow their arrows for a few hops, then realize the entry is marked and move on. The book gets thicker with stickered entries over time, paths get muddled, and eventually a librarian has to sit down and rebuild the whole book to make searches fast again.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: why tombstones rather than real deletes + three failure modes (memory, latency, recall) + compaction strategies + DiskANN as an improvement + 2026 vendor maintenance patterns + monitoring rubric.
| Operation | What HNSW does internally | Visible cost |
|---|---|---|
| Delete | Sets tombstone bit; node stays in graph | RAM and traversal cost until compaction |
| Update | Tombstones old, inserts new with fresh edges | Doubles per-vector storage until compaction |
| Insert (no churn) | Standard HNSW build: pick M neighbors via greedy descent | Comparable to ground-up build cost per vector |
| Insert (heavy churn) | Picks neighbors from a graph polluted with stale nodes | Recall degradation over time |
| Compaction / rebuild | Drop tombstones, repair edges, or build fresh graph | Expensive but restores all properties |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming HNSW deletes are free because they don't change the graph structure. Tombstones are cheap to write but expensive to live with, they cost RAM and traversal hops on every query forever, until you rebuild.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.