Module 01 · Data Systems · Data on one machine · about 19 min to read
Continue where you left off ×
Finding the nearest meaning: vector databases
Storage Extras · Open board
The board for the corners of storage the main board skipped. Its last idea, an index built for one shape of question, is the one this lesson stretches to “which points are nearest”.
Before you start. Storage Extras: richer indexes, warehouse schemas, column tricks ended with a vector index: each document becomes a list of numbers, and “similar” means “nearest”. Tokens & Embeddings showed how text becomes that list, called an embedding. RAG (Retrieval-Augmented Generation) used the nearest chunks as the open book for a model. What is near me (geohash cells, and fences by ray casting) cut a map into cells so a search reads a few cells and not every shop. This lesson opens the box that RAG (Retrieval-Augmented Generation) only named.
The idea in 30 seconds
Exact nearest search costs points × numbers per query, which is far too slow at scale.
Recall is the share of the true nearest points an index returns, and every index trades it for speed.
IVF reads only the nearest lists, HNSW walks a graph of neighbours, and PQ shrinks each point to a short code.
One setting (nprobe or ef) moves recall and cost together.
A filter applied after the search can leave an answer with too few results.
Build cost differs: IVF is cheap, a graph costs one search per insert.
Read the story
Lesson 9 of 24 in Data Systems
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year .
See plans Already a member? Sign in
Or start free : a free account opens lessons 2 and 3 of every track.
In this lesson 29 March 2017: a billion points and one question Exact search and recall: the honest way costs everything IVF: sort the points into lists, read only the nearest lists HNSW: walk a graph of neighbours PQ: keep a short code, not the full point Filtered search: the nearest points the asker may see Index build cost: the bill you pay before the first query Reading the table Filtering in real systems Hybrid search: merge two ranked lists Choosing Terms it explains: approximate nearest neighbour, Recall, IVF index, HNSW, product quantization, PQ, Common mistakes, concatenated index, data cube, edit distance, fact/dimension table, full-text index, Lucene, materialized view, multi-dimensional index, projection, R-tree, star vs snowflake schema.
Review Data Systems
Mark as read Saved in this browser, and to your account when you sign in.