Vector Databases for RAG: A Practical Guide
What a vector database actually does inside a RAG pipeline, how embeddings and indexes work together, and how to reason about them before picking a tool.

If you've read that a RAG system "stores documents as vectors," but the mechanics still feel abstract, this is the primer to fix that. Understanding what a vector database actually does — not just which one to buy — is what makes chunking, retrieval quality, and embedding choices make sense together.
What an embedding actually is
An embedding is a list of numbers — typically hundreds or thousands of them — that represents the meaning of a piece of text. Two chunks of text with similar meaning end up with embeddings that are numerically close together, even if they don't share a single word. That property, semantic closeness mapping to numeric closeness, is the entire basis of retrieval.
What the database actually stores and does
A vector database stores each chunk's embedding alongside the original text and metadata (source document, section, URL). At query time, it doesn't scan every vector one by one — it uses an index structure (commonly HNSW, a graph-based approximate-nearest-neighbour algorithm) to find the closest vectors to your query in a fraction of the time a brute-force search would take.
Why "approximate" nearest neighbour is normal, not a compromise
Exact nearest-neighbour search doesn't scale past a small dataset. Every production vector database trades a tiny amount of accuracy for a massive speed gain through approximate search — in practice, the difference between exact and approximate results is rarely noticeable, while the latency difference at scale is enormous.
The knobs that actually affect retrieval quality
- Embedding model choice — different models capture meaning differently; benchmark on your own content, not just leaderboards
- Chunk size and overlap — too large and retrieval gets fuzzy, too small and context is lost
- Top-k — how many chunks you retrieve per query; too few misses context, too many dilutes the prompt with noise
- Metadata filtering — narrowing search to a specific document type or date range before the similarity search runs
Hybrid search: vectors plus keywords
Pure vector search can miss exact matches — a product SKU, an error code, a specific name — because embeddings capture meaning, not exact strings. Hybrid search combines vector similarity with traditional keyword (BM25) search and merges the results, which is why it consistently outperforms pure vector search on content full of codes, names, or exact terms.
From concepts to a specific tool
Once these mechanics make sense, choosing between FAISS, Pinecone, Weaviate, and Chroma becomes a much simpler exercise in trade-offs — self-hosted vs. managed, hybrid search vs. pure vector, cost vs. operational simplicity. We cover that comparison in detail in our vector database selection guide.
The takeaway
A vector database is not magic — it's an efficient way to find semantically similar text at scale. Once you understand embeddings, indexing, and the trade-off between exact and approximate search, every downstream decision about chunking, top-k, and tool choice becomes a lot more concrete.
Frequently Asked Questions
Do I need a dedicated vector database, or can I use my existing SQL database?
Some SQL and NoSQL databases now ship vector extensions (e.g. pgvector for Postgres), which are fine for small to medium scale. Dedicated vector databases become worthwhile once you need very fast approximate search over millions of vectors with heavy query volume.
How many chunks should a query retrieve?
There's no universal number — start around 3-5 chunks per query and measure answer quality on real questions, adjusting up if answers are missing context or down if they're getting diluted by irrelevant chunks.