Vector Database Interview Q&A

Harry · 13 Sep 2026 · 2 views

Core Questions

Q: What is a vector database?

A: A database optimized to store embeddings and answer nearest-neighbour queries fast, using ANN indexes and metadata filtering.

Q: Exact vs ANN search?

A: Exact search compares the query against every vector and returns perfect results. ANN trades slight recall loss for orders-of-magnitude speed using structures like HNSW, IVF or quantization.

Q: Cosine, dot product or L2?

A: Cosine for meaning/text, dot product for normalized vectors or magnitude-aware ranking, L2 for geometric features. Match metric between embedding, index and query.

Indexing Questions

Q: How does HNSW work?

A: It builds a multi-layer graph. Higher layers link long-range neighbours for fast navigation; lower layers refine the result. M and efSearch control build quality and query recall.

Q: What is product quantization?

A: Each vector is split into sub-vectors that map to short codes, shrinking memory dramatically in exchange for approximating distances.

Practical Questions

Q: How do you update stale vectors?

A: Content-hash the ids, upsert on change, delete by filter when a source is removed, and re-run the eval set to catch drift.

Q: How do you combine vectors with filters?

A: Pre-filter when the filter is selective; post-filter when it is broad. Store payload metadata on every point.

Q: How do you benchmark?

A: Fixed question-to-answer set, recall@k and precision@k, latency percentiles, and memory usage at real data scale.

Key Points

  • Explain ANN tradeoffs with numbers, not slogans.
  • Keep the metric, index and query in agreement.
  • Cite recall, latency and memory together.
  • Discuss updates and monitoring, not just search.
Share this post:

Comments (0)

Please login or register to comment.