Vector Databases: Introduction
Once you've turned data into embeddings, you need somewhere to store and search them — fast. A vector database is built for exactly this: it stores embedding vectors and finds the ones most similar to a query, powering semantic search, RAG, and recommendations at scale. It's the storage layer that makes embeddings useful in real applications.
💡 In one line: A vector database stores embedding vectors and searches them by similarity — finding the nearest matches by meaning, not exact text.
What is a Vector Database?
It's a database designed to store embedding vectors and search them by similarity (nearest neighbours) rather than exact match. Each record holds a vector, an ID, and metadata, and the whole store is indexed so similarity search stays fast even across millions of vectors.
Why Not a Regular Database?
Traditional databases are great at exact and keyword lookups (WHERE title = 'cat'). But they can't efficiently answer "find the most similar by meaning" across millions of high-dimensional vectors. Vector databases use special approximate nearest-neighbour (ANN) indexes to do this quickly.
What It Stores
Each record typically has three parts:
- ID — a unique key.
- Vector — the embedding.
- Metadata — extra fields like the original text, source, tags, or timestamps.
Records are grouped into collections (or indexes / namespaces) — more on that later.
How It Works
The core flow stores data as vectors, then searches by embedding the query.Â
Key Operations
- Upsert — insert or update vectors (+ metadata).
- Query / Search — find the nearest neighbours to a query vector.
- Filter — restrict results by metadata.
- Delete — remove records.
Vector DB vs. Traditional DB
| Traditional DB | Vector DB | |
|---|---|---|
| Search by | Exact / keyword match | Similarity (meaning) |
| Stores | Rows & columns | Vectors + metadata |
| Index | B-tree, hash | ANN (approximate nearest neighbour) |
| Best for | Structured queries | Semantic search & RAG |
Popular Vector Databases
Common options include Pinecone, Weaviate, Qdrant, Milvus, Chroma, the pgvector extension for PostgreSQL, and the FAISS library. They range from managed cloud services to self-hosted and embedded libraries.
Use Cases
- RAG — retrieve relevant context for an LLM.
- Semantic search — find by meaning, not keywords.
- Recommendations, deduplication, image/audio search, and anomaly detection.
What's Ahead in This Topic
- Storing embeddings and metadata storage.
- Collections & namespaces for organising data.
- Similarity search, k-nearest neighbours, top-k retrieval, and ANN search.
Summary
- A vector database stores embeddings and searches them by similarity.
- Unlike traditional DBs (exact match), it finds the nearest vectors by meaning using ANN indexes.
- Each record holds an ID, vector, and metadata, grouped into collections.
- Core operations: upsert, query, filter, and delete.
- It's the backbone of RAG, semantic search, and recommendations. EOF echo created