Vector Databases: The Complete Guide
A vector database is a system built to store and search data by meaning rather than by exact matches. It turns text, images, or audio into long lists of numbers called vectors, then finds the items whose vectors sit closest together. That is the machinery behind semantic search, recommendations, and most retrieval-augmented AI apps.
What is a vector database?
Think of a normal database as a filing cabinet: you ask for the folder labeled "invoice 4021" and it hands you exactly that. A vector database is more like asking a well-read librarian for "something about the same idea as this paragraph." It does not look for the exact words. It looks for closeness in meaning.
It does this by storing vectors, also called embeddings. A vector is just an array of numbers, often hundreds or thousands of them, that a machine learning model produces to represent a piece of content. Similar content gets similar numbers.
The database's job is to hold millions or billions of these vectors and, given a new one, return the nearest matches fast.
Around that core job, a real vector database adds the boring-but-essential parts:
- Indexes that make "find the nearest vectors" fast instead of painfully slow.
- Metadata storage and filtering, so you can say "nearest matches, but only from documents tagged 2025."
- Persistence, backups, scaling, and access control, like any grown-up database.
How vector search works (embeddings and similarity)
The first step happens outside the database. You pass your content through an embedding model, and it returns a vector. Text like "how do I reset my password" and "I forgot my login" land near each other in this number space, even though they share almost no words.
That is the whole trick: meaning becomes geometry.
At query time, you embed the user's question with the same model, then ask the database for the vectors nearest to it. "Nearest" needs a definition, and there are a few common ones:
- Cosine similarity measures the angle between two vectors, ignoring their length. It is the most common choice for text.
- Dot product multiplies the vectors together and rewards both alignment and magnitude.
- Euclidean distance is the straight-line distance between two points, the ruler you learned in school, extended to many dimensions.
Why so many numbers? Each dimension captures some sliver of meaning the model learned during training, and none of them is human-readable on its own. You never read a vector by hand.
You trust that the model packed enough signal into those numbers that geometric closeness lines up with real-world similarity, and in practice it does that remarkably well.
The important mental model: your data becomes a cloud of points in high-dimensional space, and a search is just "which points are huddled closest to this one." Everything else is optimization to make that lookup quick.
Vector database vs a traditional database
A relational database is built for precise, structured questions: exact matches, ranges, joins, sums. It is superb at "all orders over 100 dollars from customers in Texas." It is hopeless at "documents that feel similar to this one," because feeling is not a column you can index with a B-tree.
A vector database inverts the priorities. It is built for fuzzy similarity at scale, and it treats approximate answers as a feature, not a bug. The two are not rivals so much as tools for different questions.
| Aspect | Traditional (relational) database | Vector database |
|---|---|---|
| Core question | Exact match, ranges, joins | Nearest by meaning / similarity |
| Data shape | Rows and typed columns | High-dimensional vectors plus metadata |
| Query style | SQL, deterministic | Similarity search, ranked results |
| Answer | Correct or empty | Top matches, often approximate |
| Great at | Transactions, reporting | Semantic search, recommendations, RAG |
| Weak at | "Things that feel similar" | Exact bookkeeping, strict joins |
Worth noting: the line is blurring. Several relational and document databases now bolt vector search onto their existing engines, which we will get to. So the real question is often not "which type" but "do I add vectors to what I already run, or stand up something dedicated."
When do you actually need one?
Not every project needs a vector database, and reaching for one too early is a common way to add operational weight you do not need. The honest test is whether you are searching by meaning at a size where brute force stops working.
You probably want one when:
- You are building retrieval-augmented generation (RAG), feeding relevant documents to a large language model so it answers from your data.
- You need semantic search, where results should match intent, not just keywords.
- You run recommendations, deduplication, or "find similar" over images, audio, or text.
- Your vector count is large enough that comparing against every item on each query is too slow.
You probably do not need one when:
- You only have a few thousand items. A plain array in memory, or a single library call, will search them in milliseconds.
- Your users search by exact fields, IDs, or keywords that a normal index handles well.
- You already run a database that supports vectors and your scale is modest, so adding a dependency buys you little.
The main vector databases (current landscape)
The field has settled into a recognizable set of options, and the useful way to think about them is not "which is best" but "which fits your stack and stage." Roughly, there are purpose-built vector databases, and there are general databases that added vector search. Here is the current lay of the land, verified against 2026 sources.
| Option | What it is | Best fit for |
|---|---|---|
| Pinecone | Fully managed, purpose-built vector database | Teams who want the smoothest hosted experience and minimal ops |
| Weaviate | Open-source vector database with built-in hybrid search and embedding modules | Hybrid keyword-plus-vector search, multi-tenant apps, data sovereignty |
| Qdrant | Open-source, Rust-based vector database | Fast filtered queries and low operational overhead in production RAG |
| Chroma | Lightweight, local-first, developer-friendly vector store | Prototyping and small apps, especially with LangChain or LlamaIndex |
| Milvus | Open-source vector database built for very large scale | Billion-scale workloads and enterprise deployments |
| pgvector (PostgreSQL) | Extension adding vector search to Postgres | Teams already on Postgres who want vectors without new infrastructure |
| Redis | In-memory store with a vector search module | Low-latency, real-time and session-based search plus caching |
| MongoDB Atlas Vector Search | Vector search inside MongoDB's managed platform | Apps already on MongoDB adding semantic search without re-architecting |
| Elasticsearch | Search engine with native nearest-neighbour vector search | Existing Elastic clusters wanting hybrid (keyword plus vector) search |
A few honest observations about this list:
- Pinecone, Weaviate, and Qdrant are the names that come up most for production RAG. Pinecone is the easiest to operate, Weaviate leans into hybrid search, and Qdrant is prized for fast filtered queries.
- Chroma is where a lot of projects start, because it runs locally and gets you searching in minutes. Many teams outgrow it and migrate later, which is a normal path, not a failure.
- Milvus aims at scale most teams never reach, and that power comes with more to operate.
- pgvector, Redis, MongoDB, and Elasticsearch represent the "use what you already run" camp. If your data and team already live there, adding vectors in place can beat introducing a whole new system.
One thing that trips people up: Faiss comes up in these conversations, but it is a similarity-search library, not a full database. It does the math brilliantly and is often the engine inside other tools, but you would wrap it yourself to get storage, filtering, and an API.
How indexing and approximate nearest-neighbour (ANN) search work
Here is the problem that indexes solve. The obvious way to find the nearest vectors is to compare your query against every stored vector and sort the results. That is called exact or brute-force search, and it gives perfect answers.
It also gets unbearably slow once you have millions of vectors, because the work grows with your data on every single query.
Approximate nearest-neighbour search, or ANN, is the compromise everyone makes. It accepts "almost always the right neighbours" in exchange for being dramatically faster. In practice the approximation is good enough that you would rarely notice a missing result, and the speed difference is the whole reason vector databases are usable at scale.
ANN relies on clever index structures. The two families you will hear about most:
- Graph-based (HNSW): builds a navigable graph where each vector links to nearby ones, so search hops from neighbour to neighbour toward the query. It is fast and accurate, and it is the default in many vector databases.
- Cluster-based (IVF): groups vectors into buckets and only searches the buckets nearest the query, skipping most of the data. It uses less memory and pairs well with compression tricks for huge datasets.
On top of the index, many databases add compression, often called quantization, which shrinks each vector into a smaller approximation. That lets you fit far more vectors in memory and search them faster, at the cost of a little precision. It is another version of the same bargain you keep meeting: trade a bit of accuracy for a lot of speed and scale.
Every index gives you the same dial to turn: recall versus speed. Recall is the share of true nearest neighbours you actually get back. Push for higher recall and queries slow down and use more memory; loosen it and they fly but miss the occasional match.
Tuning that trade-off for your app is a real part of the job, not a detail.
How to choose a vector database
The mistake is to start from benchmarks. Benchmarks change, and the fastest option on a chart is often the wrong pick for your situation. Start from your constraints instead, roughly in this order:
- Managed or self-hosted? If you do not want to run infrastructure, a hosted option removes a lot of pain. If you need full control or data to stay in-house, open-source and self-hosted wins.
- What do you already run? If Postgres, MongoDB, Redis, or Elasticsearch is already in your stack and your scale is modest, adding vectors there beats a new system.
- What scale are you really at? Thousands of vectors need almost nothing. Millions are comfortable for most tools. Billions narrow the field to the databases built for it.
- Do you need hybrid search or heavy filtering? If you combine keyword and vector search, or filter hard on metadata, weight that in, since options differ a lot here.
- Budget and team. A managed service trades money for time; self-hosting trades time for money. Be honest about which you have more of.
A sane way to actually get started: prototype with something frictionless like Chroma or your existing database, prove the retrieval quality is good, and only then migrate to a production system if scale or features demand it. Swapping vector stores inside a RAG pipeline is usually a small change, so you lose little by starting simple.
Common pitfalls
Most vector database pain does not come from the database. It comes from the pieces around it, and a handful of mistakes show up again and again.
- Mixing embedding models. Vectors from one model are not comparable to vectors from another. If you re-embed with a new model, you must re-embed everything, or your search quietly breaks.
- Bad chunking. For text, how you split documents into pieces before embedding matters more than the database. Chunks that are too big blur meaning; too small and they lose context.
- Chasing recall you do not need. Cranking recall to the maximum can multiply your latency and cost for matches no user would notice were missing. Tune it to the task.
- Ignoring metadata and filtering. Pure similarity often returns technically close but contextually wrong results. Filters (date, source, tenant, permissions) are what make results trustworthy.
- Reaching for one too early. If you have a few thousand items, an in-memory search is simpler and faster to ship than standing up dedicated infrastructure.
- Forgetting it is still a database. Backups, monitoring, access control, and cost at scale all apply. The "vector" part is new; the operational discipline is not.
Get the surrounding choices right, embedding model, chunking, filtering, and honest scale, and the database itself becomes the easy part. Pick the one that fits your stack and stage, start small, and upgrade when the data actually forces your hand.
Explore this topic