What is a vector database? Definition, how it works and the best tools
What a vector database stores, how it finds things by meaning, what it really costs, and which one to pick.
A vector database stores embeddings, lists of numbers that capture what a text, an image or a sound means, and finds the ones closest to your query. It answers "what is similar to this?" in milliseconds, where a classic database answers "what equals this?".
It's the memory behind most AI assistants that answer from your own documents. We compared the main options: this page explains the mechanics in plain words, walks through a real RAG example, shows where the bill and the results go wrong, sets it against the databases you already know, and reviews seven tools to start with.
The ranking is editorial: a sponsored place is always flagged on its card, and no affiliate link changes a rating.
How a vector database works, in three steps
Start with the problem. A regular database is great at exact matches: the customer whose email is X, the orders above $100. Ask it for "documents that talk about cancelling a subscription" and it only finds the rows containing those words. A help article titled "How to end your plan" slips through.
A vector database solves that in three steps.
- Embed. An embedding model turns each piece of content into a vector: a list of a few hundred to a few thousand numbers. OpenAI's text-embedding-3-small outputs 1,536 numbers, text-embedding-3-large 3,072. Content with similar meaning lands at nearby points. "Cancel my subscription" and "end my plan" end up neighbors, even with no word in common.
- Index. The database organizes those points so it can find neighbors without comparing your query to every row. The most common index is HNSW (Hierarchical Navigable Small World): a layered graph you walk from far to near, like zooming in on a map. Others exist: IVF splits the space into clusters, and product quantization (PQ) compresses vectors to save memory.
- Search. Your query goes through the same embedding model, then the database returns the k closest vectors and the content attached to them. Closeness is measured with one of three distance metrics: cosine similarity, dot product or Euclidean distance.
The key word is approximate. Comparing a query to a million vectors one by one (exact search, or KNN) is accurate but slow. Indexes do approximate nearest neighbor search (ANN): they check a small part of the graph and accept that, now and then, a true neighbor gets missed. You trade a little recall for a lot of speed, and most tools let you set where that slider sits.
Each stored item usually carries metadata too (a date, a customer ID, a language). You filter on it in the same query: "closest chunks, but only from this customer's contract". That's where dedicated tools and add-ons differ most, as the pitfalls below show.
What to demand before you compare products: the maximum number of dimensions it can index, how it filters (before or during the vector search, not after), whether it does hybrid search (keywords and vectors in one query), how it bills a query, and whether you can run it yourself if the cloud price climbs.
A step-by-step example: the assistant that answers from your help center
The most common use today is RAG, retrieval-augmented generation: before the language model answers, you fetch the relevant passages from your own content and paste them into its prompt. Here's how a support assistant built on 400 help articles works.
- Chunk. Each article is cut into passages of a few hundred words, with the article title and URL kept as metadata. 400 articles become roughly 3,000 chunks.
- Embed and store. Each chunk goes through text-embedding-3-small and lands in the vector database as a 1,536-number vector plus its metadata.
- Query. A customer types "can I get my money back if I stop after two weeks?". The question is embedded with the same model.
- Retrieve. The database returns the 5 nearest chunks. The top hit is the "Refund policy" passage, which never uses the words "money back".
- Answer. Those 5 chunks go into the LLM's prompt with an instruction: answer only from this text and link the source article.
At 3,000 chunks, you don't need much: an exact search in Postgres with pgvector answers fast enough, and Chroma runs inside a Python script. The vector database starts to earn its place when you pass a few hundred thousand chunks, filter by customer or language, or serve many queries per second.
Field tip: keep the original text and a content hash next to each vector. When an article changes, you re-embed only the chunks whose hash moved, and your index never serves a passage that no longer exists on your site.
To wire this without code, automation tools ship ready-made nodes: see the Supabase vector store node in n8n or the Qdrant vector store node. If the assistant must also take actions (open a ticket, issue a refund), you're building an AI agent, and the vector database becomes its long-term memory.
What a vector database really costs, and the traps that hurt results
Most explainers stop at "fast similarity search". Here are the numbers that decide your bill and your result quality, read in the official docs.
1. Storage grows faster than you think. In pgvector, each vector takes 4 bytes per dimension plus 8. At 1,536 dimensions, that's 6,152 bytes, so one million chunks weigh about 6.2 GB before any index. Move to a 3,072-dimension model and it doubles to about 12.3 GB. HNSW then adds its graph on top, and it lives best in RAM. Before choosing a model, multiply: chunks × dimensions × 4 bytes.
2. Big embeddings can be too big to index. pgvector's HNSW and IVF indexes take a vector up to 2,000 dimensions and a halfvec up to 4,000. text-embedding-3-large outputs 3,072 numbers, so it needs halfvec or a shorter output. OpenAI's API has a dimensions parameter for that: ask for 1,536 or 1,024 and you fit, with less storage too.
3. Filters can silently eat your results. In pgvector, an approximate index scans first and filters after. With HNSW's default search list of 40 candidates and a filter matching 10% of rows, you get about 4 rows back on average, even if you asked for 10. Since version 0.8.0, iterative index scans fix this, but you have to turn them on. On any tool, test a query with your most selective filter before going live.
4. Query price can follow your data size. On Pinecone's usage plans, a query costs 1 read unit per GB of namespace, with a 0.25 minimum. A query on a 10 GB namespace costs 10 read units. At the Standard plan's $16 to $18 per million read units (Enterprise pays $24 to $27), a million queries on that namespace cost $160 to $180. Splitting data into one namespace per customer keeps each query small.
5. "Open source" has fine print. Qdrant, Milvus and Chroma ship under Apache 2.0, and pgvector under the PostgreSQL license. Weaviate's repository is BSD-3 outside one folder; the code inside its wl folder is under a separate paid enterprise license, unlocked by a key. If self-hosting is your exit plan, read the license file, not the homepage.
6. Two databases drift apart. When your vectors live outside your main database, every update, delete and permission change must be copied over. Teams report "ghost documents": a deleted record still answering in the assistant. That's the strongest argument for pgvector or MongoDB when your data already sits there.
When you need a vector database, and when you don't
A vector database is worth it if…
- You build RAG over thousands of documents: support docs, contracts, a company wiki
- You want semantic search on a site or an app, where people type questions, not keywords
- You run recommendations: similar products, articles or profiles
- You search images or audio by similarity, or deduplicate near-identical content
- An AI agent needs long-term memory across conversations
You can skip it, or start smaller, if…
- You have a few hundred documents: exact search in pgvector or a Python library is enough
- Your questions are about exact values (IDs, prices, dates): SQL answers better
- The whole corpus fits in the model's context window and changes rarely
- You already run Postgres or MongoDB: add vector search there before adding a database
- You need perfect recall on every query, like legal discovery: pair vectors with keyword search
Vector database vs relational database, search engine and vector library: what changes
Many tools now "do vectors". Here's what separates a dedicated vector database from its neighbors, criterion by criterion.
| Vector database | The neighbors | |
|---|---|---|
| What it stores | Vectors plus metadata and the original content | Relational: rows in tables Vector library (FAISS): vectors in memory |
| How you query | "Closest to this", ranked by similarity | Relational: exact conditions in SQL Search engine: keywords ranked by BM25 |
| Finds synonyms and paraphrases | Yes, by meaning | Relational: no Search engine: only with synonym lists |
| Finds exact codes and names | Weak alone, strong with hybrid search | Relational: yes Search engine: yes |
| Persistence, updates, access control | Yes, built in | Relational: yes Vector library: up to you |
| Vector search add-on | Native, the core of the product | Postgres: pgvector extension MongoDB: Atlas Vector Search |
| Example tools | Pinecone, Qdrant, Weaviate, Milvus, Chroma | Relational: PostgreSQL, MySQL Search: Elasticsearch, OpenSearch |
A vector index (HNSW, IVF) is the data structure inside; a vector library like FAISS gives you the index without storage, updates or permissions; a vector database wraps all of it as a service.
The best tools to start with a vector database
We compared seven options, from a Python library to a managed cloud. The quick route: already on Postgres, Supabase with pgvector; already on MongoDB, Atlas Vector Search; nobody to run a server, Pinecone; you want open source you can self-host, Qdrant; keywords matter as much as meaning, Weaviate; billions of vectors, Milvus; a first prototype, Chroma. Each card gives the price, who it's for, its limit and one tip. For the full ranking with scores, see the best vector databases; to give that memory to an assistant, the best AI agent platforms.
The tools
Pinecone: the managed option with nothing to run
Easiest startPinecone is a cloud-only vector database: you create an index, send vectors, query. No server to size, no index to tune. Dense, sparse and full-text indexes are available.
Who it's for. Teams with nobody to run a database who want a working index by the afternoon.
The limit. The bill follows usage. Starter is free with 2 GB, 2 million write units and 1 million read units a month. Builder is a flat $20 a month for up to 10 GB. Standard has a $50 monthly minimum, with a 3-week trial and $300 of credits, then reads cost $16 to $18 per million units, and a query's read units grow with the namespace size. It's a proprietary managed service.
The tip. Use one namespace per customer or per document set. Queries stay small, and so does the bill. See the detail in our Pinecone pricing breakdown.
Full review: Pinecone. Looking elsewhere? Our Pinecone alternatives.
- Price
- Starter free (2 GB); Builder $20/month flat; Standard $50/month minimum + usage
- Best for
- Teams with no one to run a database
- Limit
- Usage-based bill, cloud only
- Our rating
- 4.1/5
Qdrant: the open-source default for production
Our pickQdrant is a dedicated vector database written in Rust, under the Apache 2.0 license. You run it on your own servers with Docker, or use Qdrant Cloud. It combines dense and sparse vectors for hybrid search and filters on payload (the metadata attached to each point).
Who it's for. Developers who want a dedicated store they can self-host the day the cloud bill climbs.
The limit. The managed free tier is a single node with 0.5 vCPU, 1 GB of RAM and 4 GB of disk. Past that, the Standard tier bills by the hour for CPU, memory and storage, so you size the cluster yourself.
The tip. Prototype on the free cluster, but load-test with your real filters before picking a production size. RAM, not disk, is what runs out first with HNSW.
- Price
- Free cluster (1 node, 1 GB RAM, 4 GB disk); Standard billed hourly on usage
- Best for
- Developers who want self-hosting as an exit
- Limit
- You size the cluster yourself
- Our rating
- 4.4/5
Weaviate: hybrid search ready out of the box
Hybrid searchWeaviate blends keyword and vector search in one query and returns one ranked list. For docs full of product names and error codes, that saves wiring two engines together. It can also call an embedding model for you at import time.
Who it's for. Teams whose users search with both exact terms and plain questions.
The limit. The free cloud plan runs on AWS in 2 regions with 1 collection. Flex starts at a $45 monthly minimum, billed on vector dimensions and storage; Premium starts from $400 a month on a prepaid contract. And the self-hosted code is BSD-3 except its wl folder, which needs an enterprise license key.
The tip. Flex bills per million vector dimensions. Shortening embeddings from 1,536 to 768 dimensions halves that line on your invoice; check retrieval quality on 50 real queries before you switch. To feed it from a workflow, n8n ships a Weaviate vector store node.
- Price
- Free plan; Flex from $45/month minimum; Premium from $400/month prepaid
- Best for
- Mixed keyword and semantic search
- Limit
- $45/month floor once you leave Free
- Our rating
- 4.2/5
Milvus and Zilliz Cloud: built for billions of vectors
Large scaleMilvus is an Apache 2.0 vector database that scales horizontally on Kubernetes. It comes in three sizes: Milvus Lite installs with pip for a local prototype, Standalone runs on one machine, and the distributed mode spreads billions of vectors across a cluster. Zilliz Cloud is the managed version, from Milvus's creators.
Who it's for. Teams with hundreds of millions of vectors, or a plan to get there.
The limit. Self-hosting the distributed mode means running Kubernetes and its dependencies: a real ops job. Zilliz Cloud's free plan gives 5 GB, up to 5 collections and 2.5 million vCUs a month (a vCU, or virtual compute unit, measures what your searches, inserts and deletes consume); Serverless starts from $0 on usage and Enterprise dedicated clusters from $197 a month.
The tip. Start with Milvus Lite on your laptop. The same client code then points to Standalone or Zilliz Cloud by changing the connection URI. For no-code pipelines, see the Milvus vector store node in n8n.
- Price
- Zilliz Free (5 GB); Serverless from $0 on usage; Enterprise Dedicated from $197/month
- Best for
- Very large collections
- Limit
- Heavy to self-host at scale
- Our rating
- 4.0/5
Chroma: the quickest way to prototype in Python
PrototypingChroma is an Apache 2.0 vector database you can start in memory with one pip install. That's why it shows up in so many RAG tutorials: no server, no account, five lines of code. Chroma Cloud hosts it when you go live.
Who it's for. Developers building a first RAG prototype or a notebook demo.
The limit. Chroma Cloud's Starter plan is $0 a month with $5 of free credits, then usage: $2.50 per GiB written and $0.33 per GiB stored each month. The Team plan is $250 a month plus usage. Many teams outgrow the local mode and migrate once traffic arrives.
The tip. Write your own small wrapper around add and query from day one. Moving to another database later then touches one file, not your whole app. To test retrieval without code first, n8n has a Chroma vector store node.
- Price
- Starter $0/month + usage ($5 credits); Team $250/month + usage
- Best for
- Prototypes and notebooks
- Limit
- Local mode is for development
- Our rating
- Not rated yet
Supabase (pgvector): vectors inside the Postgres you already use
On Postgrespgvector is the extension that adds a vector type and HNSW and IVFFlat indexes to PostgreSQL. Supabase hosts Postgres with pgvector ready to enable. Your embeddings sit next to your users, orders and permissions, and one SQL query joins, filters and ranks by similarity.
Who it's for. Apps already on Postgres that want RAG without a second database to keep in sync. Developers on forums say their results with pgvector on Supabase were good enough that they never needed a dedicated store.
The limit. The free plan gives 500 MB of database per project, which is roughly 80,000 vectors at 1,536 dimensions, and free projects pause after a week of inactivity, with 2 active projects at most. Pro starts at $25 a month and Team at $599 a month. And pgvector filters after the index scan unless you enable iterative scans.
The tip. Store embeddings as halfvec: half the storage, and indexes accept up to 4,000 dimensions. Compare the two with our Pinecone vs Supabase comparison.
Full review: Supabase.
- Price
- Free (500 MB per project); Pro from $25/month; Team from $599/month
- Best for
- Apps already on Postgres
- Limit
- Post-index filtering by default
- Our rating
- 4.3/5
MongoDB Atlas Vector Search: vectors next to your documents
On MongoDBAtlas Vector Search adds similarity search to MongoDB's managed cloud. A query is an aggregation pipeline whose first stage is $vectorSearch, so you filter and reshape results with the stages you already know. It takes embeddings up to 8,192 dimensions.
Who it's for. Teams whose app data already lives in MongoDB documents.
The limit. You pay for the cluster, not per query: Flex clusters cost up to $30 a month, dedicated clusters start at $56.94 a month, billed by the hour. A vector-heavy workload pushes you toward bigger dedicated tiers faster than your document data alone would.
The tip. Put the fields you filter on (tenant, language, date) in the vector index definition. Then the filter runs inside $vectorSearch, on the candidates, instead of in a later $match stage that trims the results. In n8n, the MongoDB Atlas vector store node reads and writes the same index.
- Price
- Flex up to $30/month; Dedicated from $56.94/month (hourly billing)
- Best for
- Apps already on MongoDB
- Limit
- Cluster sizing drives cost
- Our rating
- Not rated yet
Is your tool missing from this page? Email us: hello@hackceleration.com
Vector database FAQ
What is the difference between dense and sparse vectors?
A dense vector fills every dimension with a number, while a sparse vector is mostly zeros and stores only its non-zero values with their positions. Dense vectors come from embedding models and carry meaning; sparse vectors usually weight individual words, like a keyword index, which is why hybrid search combines both. In Qdrant, a dense vector has a fixed length of up to 65,536 dimensions, while a sparse vector has no fixed length: you send the list of non-zero elements and their indexes.
Can I use Elasticsearch as a vector database?
Yes, for many apps: Elasticsearch stores embeddings in a
dense_vectorfield and runs k-nearest neighbor search on an HNSW index, next to its keyword search. The field can't exceed 4,096 dimensions, so text-embedding-3-large's 3,072 fit, and recent versions quantize float vectors by default to save memory. It makes the most sense when your search already runs on Elasticsearch.Which similarity metric should I use for text?
Use the one your embedding model was trained for, usually cosine similarity. OpenAI embeddings are normalized to length 1, so a dot product gives the same ranking as cosine and computes slightly faster. Euclidean distance mostly matters for image and unnormalized vectors.
Does a vector database return the exact closest matches?
No, not with an ANN index: it returns very likely neighbors and can miss a few. In pgvector, the HNSW search list defaults to 40 candidates; raising
hnsw.ef_searchto 100 improves recall at the cost of speed. Measure recall on a sample against an exact search before tuning.What is hybrid search?
Hybrid search runs a keyword search and a vector search on the same query, then merges the two rankings, often with reciprocal rank fusion (RRF). It catches exact terms like SKUs or error codes that embeddings blur. In Postgres, you combine pgvector with the built-in full-text search.
Is a vector database a NoSQL database?
Most dedicated vector databases are non-relational, so they're often filed under NoSQL. The line is blurring: relational and document databases now add vector search as a module. MongoDB Atlas Vector Search, for instance, indexes embeddings up to 8,192 dimensions inside regular documents.
How many dimensions should my embeddings have?
Fewer than you'd think: 768 to 1,536 dimensions cover most text search. OpenAI recommends the
dimensionsparameter to shorten its embeddings at creation time instead of truncating them yourself. Halving dimensions halves storage and the per-dimension part of the bill.What happens when I change embedding models?
You re-embed your whole corpus, because vectors from two models aren't comparable. Plan for it: keep the source text and model name next to each vector, build the new index alongside the old one, and switch traffic once recall checks pass on your own test queries.