← Back to RAG and Vector Databases
Lesson 16.3 · Interview Preparation and System Design

Interview: Choosing a Vector Database

How to reason about vector databases in an interview: what they add over a list of vectors, approximate search and HNSW, metadata filtering, updates and deletes, hybrid search support, managed vs self-hosted, pgvector vs a dedicated database - and three workload scenarios to choose for.

Intermediate30 min

What you will be able to do

  • Explain what a vector database adds
  • Explain approximate search and HNSW in simple words
  • Discuss filters, updates, deletes and hybrid search
  • Compare pgvector, embedded and dedicated databases
  • Choose a database for a given workload

The idea, in plain English

"Which vector database would you use?" has no single right answer. Interviewers want to hear how you reason: which questions you ask about the workload, and which trade-offs you see.

Know the core ideas: approximate nearest-neighbour search, index types, metadata filters, and what updates and deletes cost. Then match a database to the workload.

RAG Modules 3 and 4 teach vector databases in full; the Agentic AI lessons on vector stores (2.10, 2.15) show Chroma in practice.

Worked example: Twelve vector database questions and three workloads - a prototype, a Postgres shop, and a 100-million-chunk platform.

Basic: What is a vector database?

A database that stores vectors together with their text and metadata, and finds the vectors nearest to a query vector quickly, using a special index.

  • Examples: Chroma, FAISS (a library), pgvector, Qdrant, Weaviate, Milvus, Pinecone.

Basic: Why not just keep vectors in a Python list?

For a few thousand vectors a list is fine. At millions, comparing the question with every vector is too slow, and you also need persistence, filters, updates, concurrency and backups - which a database gives you.

  • Lesson 2.4 stored 7 vectors in JSON - fine for learning only.

Intermediate: What is approximate nearest-neighbour (ANN) search?

Finding vectors that are very likely the nearest, without comparing against all of them. It trades a small loss in accuracy (recall) for a large gain in speed.

  • Exact search: perfect but slow at scale.
  • ANN: tune it to the recall you need.

Intermediate: What is HNSW, in simple words?

Hierarchical Navigable Small World: a layered graph where each vector links to nearby vectors. A search starts on a sparse top layer, jumps close to the target, then walks down to denser layers to refine - like taking a highway, then main roads, then streets.

  • Fast and accurate; uses a lot of memory.
  • Parameters trade build time and memory for recall.

Intermediate: What is metadata filtering, and why does it matter?

Restricting search by fields stored with each chunk - department, date, language, user permissions. It narrows results to what is allowed and relevant.

  • Permissions must be enforced as filters at query time.
  • Some databases filter before the vector search, others after - which affects results.

Intermediate: How do you update or delete documents in a vector database?

Give every chunk a stable ID (for example file + chunk number), delete the old chunks of a changed document and insert the new ones, and remove all chunks of deleted documents.

  • Without stable IDs, updates leave old pieces behind.
  • Agentic AI Lesson 2.15 updates a file cleanly.

Advanced: pgvector or a dedicated vector database?

pgvector adds vector search to PostgreSQL: one system, transactions, joins with your normal data, and familiar operations. Dedicated databases offer more index options, better performance at very large scale, built-in hybrid search and easier horizontal scaling.

  • Already on Postgres with millions of vectors: pgvector is often enough.
  • Hundreds of millions, heavy filtering at high traffic: consider dedicated.

Advanced: Managed service or self-hosted?

Managed (Pinecone, cloud offerings) means no operations, fast start and easy scaling, but cost, data leaving your network and vendor lock-in. Self-hosted gives control and possibly lower cost at scale, but you run backups, upgrades and scaling.

  • Check data-residency rules first.

Advanced: What questions do you ask before choosing a vector database?

How many vectors now and in two years? How many queries per second and what latency? Which filters? How often do documents change? Do we need hybrid search? Who operates it? What is the budget, and what do we already run?

  • The answers usually decide it before benchmarks do.

Professional: Scenario: a two-week prototype with 5,000 documents.

Use an embedded store like Chroma or FAISS, or pgvector if Postgres is already there. Focus the time on chunking, evaluation and the user experience - not on infrastructure.

  • Design the code so the store can be swapped later.

Professional: Scenario: an enterprise with 100 million chunks, strict permissions and 200 queries per second.

A distributed vector database (self-hosted or managed) with strong filtering, sharding and replication, hybrid search, per-tenant or per-permission filters, incremental ingestion and monitoring - chosen after a load test with real filters and data.

  • Benchmark with your own vectors and filters, not marketing numbers.

Professional: How would you benchmark vector databases fairly?

Use your own data and queries, the same embeddings and recall target, realistic filters, concurrency and update load, and measure recall, p95 latency, throughput, memory and cost - including index build and update times.

  • A database is only fast at the recall you actually need.

Key points

  • A vector database adds a fast ANN index, metadata, updates and operations to vectors.
  • ANN trades a little recall for a lot of speed; HNSW is the common index.
  • Filters enforce permissions; stable IDs make updates safe.
  • Choose by workload: scale, filters, updates, hybrid search, operations, cost.
  • Benchmark with your own data, filters and recall target.

Interview questions

Is FAISS a database?

It is a library for vector search; you add storage and the rest yourself.

What is recall in ANN search?

The share of true nearest neighbours the index actually finds.

What does HNSW cost?

Mostly memory, plus index build time.

What is a namespace or collection?

A separate group of vectors, often per tenant or per data type.

Why stable chunk IDs?

So updates replace old chunks instead of duplicating them.

What is sharding?

Splitting data across machines to scale.

What is a replica?

A copy of the data for more read capacity and failover.

What is pgvector?

A PostgreSQL extension for storing and searching vectors.

Comments

Sign in to leave a comment. Your name and photo come from Google; nothing else is shared.

Loading comments...