RAG & Retrieval·Question 22 of 100Intermediate

How do you choose a vector database? pgvector vs dedicated vector stores vs search engines.

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Lead with the heuristic: "use pgvector until it hurts" - then show you know exactly where it hurts.

Full worked answer

Lead with the heuristic: "use pgvector until it hurts" - then show you know exactly where it hurts.

pgvector (Postgres extension, HNSW and IVF support): your chunks' metadata is probably already in Postgres, so you get joins, transactions, backups, row-level security, and one operational system instead of two. Vectors live next to the data they describe - no sync pipeline between an OLTP store and a vector store, no consistency bugs where a deleted document still surfaces from a stale index. For the majority of products - up to single-digit millions of vectors and moderate QPS - this is simply the right call, and interviewers respect candidates who don't reach for exotic infra by default.

Where it hurts: very large scale (roughly 50-100M+ vectors, where index build times, RAM, and single-node limits bite), high-QPS vector workloads competing with your transactional load, heavy filtered-ANN queries (pgvector 0.8's iterative index scans fixed the worst over-filtering starvation, but dedicated engines still have more filter-aware graph traversal), and thinner niceties (no built-in hybrid fusion or native multi-vector/ColBERT support, and quantization limited to half-precision and binary rather than PQ).

Dedicated vector stores (Qdrant, Milvus, Weaviate, Pinecone, Turbopuffer, Vespa): built for exactly those pains - horizontal sharding, tunable quantization, good filtered search, hybrid search built in, disk-backed or serverless economics for huge corpora. Cost: another stateful system to operate (or a vendor bill), plus a data-sync pipeline from your source of truth, which is a chronic source of staleness bugs.

Search engines (Elasticsearch/OpenSearch): the right answer when you already run them or when the workload is lexical-first - mature BM25, faceting, aggregations, permissions tooling - with kNN vectors added alongside. Choosing ES purely as a vector DB is usually overweight; choosing it for hybrid search over an existing logging/search estate is sensible.

Decision criteria to enumerate: current and 2-year vector count, QPS, filter selectivity patterns, hybrid needs, ops capacity, data-residency constraints, and whether the vector store must be the source of truth (it shouldn't be - keep raw text elsewhere so you can re-embed).

What a good answer covers

  • Lead with the heuristic: "use pgvector until it hurts" - then show you know exactly where it hurts
  • pgvector (Postgres extension, HNSW and IVF support)
  • Vectors live next to the data they describe - no sync pipeline between an OLTP store and a vector store,…
  • Where it hurts: very large scale (roughly 50-100M+ vectors, where index build times, RAM, and…
  • Dedicated vector stores (Qdrant, Milvus, Weaviate, Pinecone, Turbopuffer, Vespa)

Key terms: "use pgvector until it hurts" · pgvector · filtered-ANN · Dedicated vector stores · Search engines

Interviewer follow-ups to expect

  1. What consistency bugs appear when the vector index is a separate system from the document store?

  2. Your filtered queries hit a 5%-selectivity tenant filter - how does that change the choice?

  3. When is Elasticsearch's BM25 maturity worth its operational weight?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep