Vector Databases
A vector database stores embeddings and answers nearest-neighbour queries, the core primitive behind semantic search and retrieval-augmented generation.
Definition
A vector database is a system specialised for storing high-dimensional vectors and efficiently finding the vectors closest to a query vector under a chosen distance metric.
Context and scope
It indexes embeddings produced by models so applications can run similarity search at scale.
Common misconceptions
- exact nearest neighbour is always affordable
- cosine similarity and Euclidean distance always rank identically
Anti-patterns
- choosing an index without measuring recall against the workload
- storing raw vectors without metadata for filtering
Related concepts
Related examples
Authoritative source
Definition
A vector database is a system specialised for storing high-dimensional vectors and efficiently finding the vectors closest to a query vector under a chosen distance metric.
It indexes embeddings produced by models so applications can run similarity search at scale. Compared to simpler alternatives, this concept fits best when the trade-off it represents is the one the system actually cares about.
When to use it
A common use case is applying it at the boundary where the cost of getting it wrong is highest, and the scenario usually involves a concrete guarantee the system must uphold. Unlike an ad hoc approach, it makes that guarantee explicit, reviewable, and testable.
How it works
Approximate nearest-neighbour indexes trade a small recall loss for large speed gains, so recall must be measured against a brute-force baseline for the real data.
Distance metric matters: normalised vectors are often compared by cosine or dot product, and mixing metrics between indexing and querying breaks ranking.
Trade-offs and alternatives
Metadata filtering and hybrid search, combining vectors with keyword conditions, are usually needed because pure similarity ignores hard constraints. The main drawback is the extra complexity it introduces, so the benefit should clearly outweigh that cost before a team adopts it.
Common misconceptions
A persistent misconception is that exact nearest neighbour is always affordable. Another is that cosine similarity and Euclidean distance always rank identically. For example, an engineer who assumes otherwise may design around a guarantee that does not actually exist, which only becomes obvious under load or failure.
Anti-patterns to avoid
Two recurring anti-patterns are to choosing an index without measuring recall against the workload and to storing raw vectors without metadata for filtering. Both tend to surface as hard-to-debug production issues rather than obvious test failures. Related concepts include Semantic Search, Text Embeddings, Tokenization and Subword Units.