Skip to content

Vector Database

A store for embeddings that can quickly find the vectors most similar to a query among millions, the retrieval engine behind semantic search and RAG.

Also vector search · approximate nearest neighbor · ANN · HNSW · FAISS · semantic search · embedding index

Fig. / How it works
QueryQueryEmbed to a vectorEmbed to a vectorNearest neighboursNearest neighboursTop matchesTop matches
Role · kind
Using and applyingTechnique
Level
Intermediate

A library where books are shelved by meaning, not title. Ask for something, and the librarian walks straight to the shelf of books most like your question.

Where it fits

+All relationships as a list

See it on the full map

How it works

Embeddings turn text, images or products into vectors where similar meaning means nearby. Finding “the most similar items” is then a nearest-neighbor search. With a few thousand items you can compare against all of them; with hundreds of millions you cannot.

Vector databases build an index that finds near neighbors without checking everything:

  • Graph indexes (HNSW): each vector links to some neighbors; a search hops through the graph toward the query, like asking for directions from person to person.
  • Clustered indexes: group vectors into buckets (k-means style) and search only the closest buckets, often with compressed vectors.

These are approximate: they occasionally miss a true neighbor, in exchange for speedups of hundreds or thousands of times. On top come practical features: filtering by metadata (only documents from this team), updates, and combining with keyword search. In a RAG system, this is the step that fetches the passages the model then reads.

Everyday use cases

  • Case 01

    RAG over company documents

    Find the passages most relevant to an employee's question.

  • Case 02

    Similar products and images

    "More like this" recommendations from image or product embeddings.

Strengths, weaknesses and when to use it

Strengths

  • Millisecond search over millions of items by meaning.

Weaknesses

  • Approximate: can miss some true nearest neighbors.
  • Results are only as good as the embeddings.

When to use itWhen you need to search large collections by similarity rather than exact keywords.

Compare with

Check yourself

  1. Q01

    Why do vector databases use approximate search?

    Show answer

    A: Comparing a query with every stored vector is too slow at large scale

Go deeper

Learn first