Vector Databases

13 min read

A vector database stores embeddings and finds the nearest ones very fast. It does not compare your query with every item. It looks only in the right neighbourhood. In this lesson you see how much work that saves, and what it costs.

New words

Vector database
A database made to store vectors and find the nearest ones fast.
Top-k
The k closest items to your query. For example, the top 5.
Exact search
Compare the query with every stored vector. Always correct, but slow.
ANN
Approximate nearest neighbour search: very fast, but it can miss some results.
HNSW
A popular ANN method that uses layers of links, like highways and roads.
Recall
How many of the true nearest items your search found.
Metadata filter
A rule on extra fields, for example only items from 2025.

What you will learn

  1. The problem: one question, ten lakh answers
  2. What a vector database stores
  3. Exact search and why it gets slow
  4. Approximate search: look only nearby
  5. HNSW: a map with highways and local roads
  6. Try it: exact search against ANN
  7. Recall, speed and filters
  8. In a real system
  9. Interview tip
  10. Key takeaways

10 quiz questions at the end.

Start this lesson

The full lesson, with interactive demos and the quiz, opens after you sign in with Google. It is free.

All lessons · Back to the roadmap