Question presented to candidate: "Everyone says you need a vector database for RAG. What is a vector database actually, what does it do that a list of vectors in memory does not, and how would you decide whether our project needs one?"
What a strong answer should cover:
- A vector database stores vectors with their IDs and metadata and answers "the k nearest vectors to this one, matching this filter", using an approximate nearest neighbour index, plus the normal database jobs: inserts, updates, deletes, persistence, replication and access control
- The options form a ladder: exact search in application memory or a library, a vector extension in the database you already run (such as pgvector in Postgres), or a dedicated vector database or managed service
- The decision is sizing arithmetic: vectors x dimensions x 4 bytes of memory, and vectors x dimensions multiply-adds per exact query, against the latency target and query rate
- Exact search over tens of thousands of vectors, or over a filtered per-tenant subset, is fast and perfectly accurate; ANN indexes matter at millions of vectors or high query rates
- A separate vector store adds a second copy of your data that must be kept in sync (deletes, permission changes, updates); keeping vectors next to the rows avoids that drift
- Signals that justify a dedicated system: very large or fast-growing collections, strict latency at high QPS, heavy filtered search, built-in hybrid search, or a team that does not want to operate it
Code / implementation expected: Optional โ the memory and compute arithmetic, or a short exact top-k loop with a filter, is a strong signal.