Why this matters
- PolicyDesk started on a Python list and brute-force cosine. It was fine at 200 chunks and painful at 200,000.
- Interviewers want a reason to pick Qdrant or pgvector or Pinecone, not a logo list.
- Metadata filters are half the product. Pure nearest-neighbor will surface an archived policy that happens to use the same words.
- Approximate search is a recall trade. You should be able to say what you might miss.
What problem it solves
A vector database is built to store, index, and search high-dimensional embeddings. Given a query vector, it returns the closest stored vectors under a distance metric, along with the payload you saved beside them: the text, the page, the department.
Keyword search finds strings. Vector search finds neighbors in meaning. RAG needs the second one, and it usually wants the first one as well, which is why hybrid search shows up in the next lesson. The vector store is still the system of record for the embeddings.
What you store per point
- The vector itself, with a dimension fixed at collection creation.
- A payload (metadata) including the chunk text, source, page, title, department, and version.
- An id you can upsert or delete when that chunk changes.
How a search runs
Exact search computes the metric against every vector. That is correct and simple, and it is what FAISS will do with a flat index. It gets expensive as the corpus and the dimension grow, because every query touches every point.
Approximate nearest neighbor (ANN) builds a structure — a graph, clusters, or a tree — so the search visits a promising subset. You get most of the true neighbors, much faster, and you occasionally miss the exact nearest point. For RAG, missing the single best chunk is acceptable only if your top-k and your eval set say the right evidence still appears. If a compliance answer must be the exact nearest paragraph, measure recall before you turn on ANN.
The rest of this guide is part of Pro
Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.
Still to come · 5 sections
- Algorithms worth naming
- The databases people compare
- Architecture around the database
- Store a point with metadata
- Habits that keep the index honest
Test yourself
Answer these before moving on — recall is what makes it stick.