Vector Database
Stores embedding vectors and retrieves nearest neighbors — powers semantic search, RAG, and recommendations.
Interview tip Lead with a 30-second definition, then one real system example and name 2–3 designs where Vector Database is non-negotiable.
① What it is (30 seconds)
Stores embedding vectors and retrieves nearest neighbors — powers semantic search, RAG, and recommendations.
② How it works in system design
Embed text/image to float vector. Index with HNSW or IVF for approximate nearest neighbor. Query embed → top-K similar vectors → fetch original documents.
Typical placement
Client→Edge / Gateway→Vector→Services→Data stores
③ Concrete system design example
Scenario: RAG chatbot: chunk docs, embed, store in Pinecone. User question embedded → top-5 chunks retrieved → fed to LLM context window.
④ Important interview Q&A
| Question | Answer |
|---|---|
| Vector DB vs Elasticsearch? | Vector DB optimized ANN on embeddings; ES adding vector but inverted index is lexical core. |
| Same model for index and query? | Yes — dimension and semantic space must match. |
| Metadata filters? | Pre-filter by tenant_id then vector search — common production pattern. |
⑤ Seen in these system designs
- RAG — retrieval layer
- ChatGPT System — plugin search
- Google Photos Duplicate — similarity
In interviews, after explaining the concept, say: "This shows up directly in …" and link two designs.
⑥ Revision checklist
- Embedding pipeline
- ANN index type
- top-K recall
- Metadata filters
- Same model index/query