Learn · Vector Search
Vector search & nearest neighbours
Embeddings turn documents into points in space; search means finding the points nearest your query. Exact search checks everything — accurate but slow. Real vector databases use approximate search to go fast. Click anywhere to run a query and see the trade-off.
Comparisons
—
distance calculations
Recall @ k
—
true neighbours found
Speed-up
—
vs checking every point
The trade-off
Exact k-NN compares the query to every point — perfect recall, but cost grows with the whole dataset. With millions of vectors that's too slow. Approximate nearest-neighbour (ANN) indexes the space into regions and only searches the promising ones, so it does far fewer comparisons — but can occasionally miss a true neighbour near a boundary (recall < 100%). Vector databases like FAISS, HNSW and pgvector are all about winning as much speed as possible while keeping recall high.
A teaching model: points are 2-D and ANN uses a simple grid index (search the query's cell and its neighbours). Production ANN uses smarter structures (HNSW graphs, IVF, product quantisation) over hundreds of dimensions — see how documents become vectors in the Embeddings demo and how retrieval feeds a model in the RAG demo.