Vector Databases
GenAI SystemsA database built to store embeddings and quickly find the ones nearest to a query vector, using an approximate index instead of checking every vector.
To find books similar to the one in your hand, you walk to the right shelf, then to the shelves next door. You do not read every spine in the library. A vector database builds that kind of shelving for vectors: it groups similar ones together so a search only visits the few shelves that can matter.
What it stores. Each record holds an ID, the vector itself and metadata such as the source document, a date or who may see it. Queries ask: "give me the 10 vectors closest to this one", optionally restricted by metadata (for example only this customer's documents).
Why not just compare everything? With 50 million vectors of 768 numbers each, one query done by brute force is about 38 billion multiplications. That takes far too long for an interactive search, and it repeats for every query. The fix is an approximate nearest-neighbor (ANN) index: a structure that finds neighbors that are almost always the true closest ones, in a tiny fraction of the time.
Two common index families. HNSW (Hierarchical Navigable Small World) is a layered graph. A search starts on a sparse top layer, hops toward the query, and drops down to denser layers to refine. It is fast and accurate but uses a lot of memory. IVF (inverted file) clusters the vectors into buckets and searches only the few buckets nearest the query, often combined with compression to cut memory.
Distance metrics. Cosine similarity compares direction, Euclidean distance compares straight-line distance, and dot product mixes direction and length. Use the one your embedding model was trained for.
The trade-off to remember. An approximate index may miss a true nearest neighbor. You tune the balance between speed, accuracy (recall) and memory. Teams also choose between a dedicated vector database, a vector extension on a database they already run (such as pgvector for PostgreSQL), or a library like FAISS that does the search but is not a database.
- A vector database is for nearest-neighbor lookups, not exact-match queries.
- ANN indexes trade a little accuracy (recall) for a huge gain in speed.
- HNSW favors speed and accuracy at the cost of memory. IVF saves memory and works by searching only a few buckets.
- Metadata filtering (this tenant, this date range) is as important in practice as the vector search itself.
- At small scale, a brute-force scan or pgvector may be all you need.
Curated Curation & Deep Insights
ScaleDojo CertifiedOur system architects are vetting high-quality, authorized video guides for Vector Databases with zero third-party platform links.
We are preparing premium, zero-competitor deep-dives for Vector Databases. Authorized reading references will appear automatically.