Intermediate LevelAI, LLMs, Embeddings & MCP
How do you handle Vector Index maintenance, updates, and deletes in production vector databases?
❓ Interview Prompt: Explain soft deletes (tombstoning), graph fragmentation, background index compaction, and memory management.
Unlike traditional relational database indexes, updating or deleting vectors in graph indexes (like HNSW) is computationally expensive because nodes are interconnected via graph edges.
Maintenance Strategies:
1
Soft Deletes (Tombstoning): Deleting a document marks the vector node as tombstoned. The node remains in the graph to maintain connectivity, but is filtered out during queries.
2
Background Compaction: Periodic background jobs build a clean new index graph and purge tombstoned nodes to reclaim RAM.
3
Immutable Segment Merging: Engines like Qdrant write new vectors into small append-only segments, merging them into larger optimized segments in background worker threads.
Code Implementation Example
typescript
// Qdrant segment optimization trigger
await client.updateCollection('documents', {
optimizer_config: {
deleted_threshold: 0.2, // Trigger background compaction when 20% vectors are deleted
vacuum_min_vector_number: 1000
}
});💡Configuring background vector index vacuum and compaction thresholds.
🎯 Interview Key Takeaway
Deletes in vector graph indexes use soft tombstoning; periodic background compaction rebuilds graphs to reclaim memory.
#Vector DB#Maintenance#HNSW#Compaction#Intermediate
Back to all AI, LLMs, Embeddings & MCP Questions→