A customer types “my parcel never showed up” into your help search. It shows them gift cards.
A vector database fixes that. It stores text as embeddings, lists of numbers that capture meaning, and finds the closest match even when no words overlap. You need one for semantic search, RAG chatbots and recommendations. For a small app, Postgres with pgvector is enough.
We ran nine customer questions through both. Vector search got 7 right. Keyword search got 3.
Its two misses show the catch nobody mentions.
What is a vector database, in plain English?
A vector database stores data as vectors and finds the ones closest to a query. Closeness stands in for similarity of meaning.
Think of a map where every sentence gets a spot. Sentences about the same idea land close together, so “how do I get my money back” sits beside “refunds go to the original payment method.” No useful word is shared.
That spot is the embedding. An embedding model turns text into a fixed-length list of numbers; our generative AI explainer covers how these models learn. The one we tested outputs 384 numbers per sentence. OpenAI’s text-embedding-3-small outputs 1,536.
How does a vector database work?
It works in four steps: split your data, embed it, store the vectors, then find each query’s nearest neighbours.

From your documents to an answer
The same four steps run inside Pinecone, Qdrant, Chroma or Postgres with pgvector.
-
Step 1 of 4
Split your data into chunks
Cut help articles, product pages and PDFs into passages of a few hundred words. Clean chunks matter more than the database; our guide to scraping websites for LLMs shows how to prepare them.
-
Step 2 of 4
Embed every chunk
An embedding model turns each chunk into a vector. This is the slow, compute-heavy part of the job.
-
Step 3 of 4
Store the vectors with their metadata
Keep each vector next to its original text and fields like product or date, so you can filter later.
-
Step 4 of 4
Embed the query and find its neighbours
The question goes through the same model and the database returns the closest vectors. A different model for queries turns matches into noise.
Cosine, dot product or Euclidean: which distance should you use?
Use whatever your embedding model was built for. For most text models, that’s cosine similarity.
| Metric | What it measures | Use it when |
|---|---|---|
| Cosine similarity | The angle between vectors, ignoring length | Most text search |
| Dot product | Angle and length together | Your model outputs normalised vectors (same ranking as cosine, a bit faster) |
| Euclidean (L2) | Straight-line distance | Image or sensor data, or when the model docs say so |
Pick the wrong one and results still come back, just ranked worse. Nobody notices.
Why it doesn’t check every vector: HNSW and IVF
Checking every stored vector is exact but slow at scale. So vector databases build an index that checks a small, promising slice instead.
HNSW links vectors into a layered graph and hops toward the query. IVF groups vectors into clusters and searches only the nearest few. Both trade a little accuracy for a lot of speed.
How little accuracy? We embedded 19,341 real sentences and searched them with 200 held-out ones, on a single CPU core:
| Search method | Time per query | True top-10 found |
|---|---|---|
| Exact (check every vector) | 0.94 ms | 100% |
| HNSW, search width 40 (pgvector’s default) | 0.061 ms | 96.9% |
| HNSW, search width 100 | 0.188 ms | 99.2% |
| IVF, 139 clusters, search 10 | 0.089 ms | 85.7% |
| IVF, 139 clusters, search 1 | 0.020 ms | 51.8% |
HNSW at its default was 15 times faster and still found 97 of every 100 true matches. IVF was quicker still at small settings but missed far more, even at 10 clusters searched.
Now look at the exact row. Under a millisecond for nearly 20,000 vectors means a small app needs no index at all. Scaled up, a million vectors would take about 50 ms per query, roughly where an index starts to pay. We didn’t run a million-vector test.
Keyword search vs vector search: what our test showed
Vector search found the right help article for 7 of 9 queries. Keyword search found 3.

We wrote 12 help-centre articles for an imaginary clothing shop and typed nine questions like a fed-up customer. Keyword search used SQLite’s full-text engine with BM25 ranking, minus common words. Vector search used Chroma 1.5.9 with its default all-MiniLM-L6-v2 model and cosine distance.
import chromadb
client = chromadb.EphemeralClient()
docs = client.create_collection("help", configuration={"hnsw": {"space": "cosine"}})
docs.add(
ids=["refunds", "returns"],
documents=[
"Refunds go to the original payment method within five to ten days.",
"You can send back unworn items within 30 days.",
],
)
hit = docs.query(query_texts=["how do I get my money back"], n_results=1)
print(hit["ids"][0], 1 - hit["distances"][0][0]) # best match and its similarity
Chroma fetched its 79 MB model on the first run, then answered offline. The full test ran the same code on all 12 articles:
| Customer typed | Keyword search returned | Vector search returned |
|---|---|---|
| my parcel never showed up | Gift cards (matched “never”) ✗ | Lost parcel ✓ |
| how do I get my money back | Returns (matched “back”) ✗ | Refunds ✓ |
| I forgot my login details | Password reset ✓ | Password reset ✓ |
| stop charging my card every month | Nothing ✗ | Cancel membership ✓ |
| can you deliver to Canada | Nothing ✗ | International shipping ✓ |
| receipt for tax purposes | Nothing ✗ | VAT invoice ✓ |
| the jacket came torn | Jacket product page ✗ | Jacket product page ✗ |
| SKU-4471 | Jacket product page ✓ | Jacket product page ✓ |
| SKU-9902 (doesn’t exist) | Nothing, as an exact phrase ✓ | Jacket product page ✗ |
Keyword search failed as expected. It grabbed a stray shared word, or found nothing because the customer said “receipt” and the article said “invoice.”
The vector misses are the interesting part.
“The jacket came torn” went to the jacket page, not the damaged-items policy. The embedding latched onto the product. Meaning search is fuzzy, and fuzzy is sometimes wrong.
“SKU-9902” is worse. That product doesn’t exist, yet vector search still returned the jacket, with a similarity of 0.32. The real code, SKU-4471, scored 0.33. A vector database always hands back its nearest neighbour, and no score threshold could split those two.
Our take: Use both. Hybrid search runs keyword and vector search together, so exact codes, names and error messages still match exactly. Then test 20 real customer questions before you trust the scores.
This was one small model on 12 English articles. A bigger model might fix the jacket query; we didn’t try one. No model says “no match” by itself.
Vector database vs traditional database: do you need a new one?
Usually not at first. A vector database adds similarity search; it doesn’t replace the one holding your orders and users.
| Traditional database | Postgres with pgvector | Dedicated vector database | |
|---|---|---|---|
| Best question | Which rows match exactly? | Both, in one query | Which items are most similar? |
| Joins and transactions | Yes | Yes | Limited or none |
| Where it shines | Orders, users, payments | Apps up to a few million vectors | Very large or fast-growing vector sets |
pgvector turns Postgres into a vector store. It searches exactly by default and adds HNSW or IVFFlat indexes when you need speed. Indexes cover up to 2,000 dimensions. Your vectors live next to your rows, so one query can filter by customer and rank by meaning.
Here’s our cosine search in Postgres. <=> is pgvector’s cosine distance operator, and $1 is the query’s embedding:
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE help_docs (id text PRIMARY KEY, body text, embedding vector(384));
CREATE INDEX ON help_docs USING hnsw (embedding vector_cosine_ops);
SELECT id, 1 - (embedding <=> $1) AS similarity
FROM help_docs
ORDER BY embedding <=> $1
LIMIT 3;
We didn’t run this on a live Postgres for this post. The syntax follows pgvector’s own documentation. Want to try it without installing anything? Managed Postgres on DigitalOcean supports the vector extension on versions 14 to 17.
Heads-up: the DigitalOcean and n8n links on this page are affiliate links. We may earn a commission if you buy, and your price stays the same.
Which vector database should you pick?
Start with what you already run. Move to a dedicated engine when vector search is the product, not a feature.
| Option | Free tier (15 Nov 2026) | First paid step | Pick it if |
|---|---|---|---|
| Postgres + pgvector | Free, open source | Your Postgres host’s price | You already use Postgres |
| Supabase | 500 MB database | Pro, $25/month | You want Postgres, auth and vectors in one place |
| Pinecone | Starter: 2 GB storage | Builder, $20/month flat | You want zero servers to manage |
| Qdrant Cloud | 1 GB RAM, 4 GB disk | Usage-based | You want open source with a managed option |
| Weaviate Cloud | 100,000 objects | Flex, from $45/month | You want built-in hybrid search and hosted embeddings |
| Zilliz Cloud (Milvus) | 5 GB storage | Serverless, usage-based | You expect hundreds of millions of vectors |
| Chroma | Free locally; $5 cloud credit | Usage-based | You’re prototyping in Python |
We checked every price on 15 November 2026. One trap: Supabase pauses free projects after a week without activity, so don’t demo a client app on it.
Running the open-source versions yourself? A small virtual private server handles Qdrant or Chroma for a side project. Watch the memory, because HNSW indexes want to live in RAM.
Best for / not ideal for: Pinecone suits a team that wants search live this week with no servers to patch. It’s a poor fit when vectors must sit beside your app’s rows, because every query then spans two systems. That’s pgvector’s home turf.
How much space do your vectors actually take?
Each pgvector vector takes 4 bytes per dimension plus 8. Dimensions, not document length, decide the bill.
| Embedding size | One vector | 1 million vectors (raw) |
|---|---|---|
| 384 dims (all-MiniLM-L6-v2) | 1,544 bytes | 1.5 GB |
| 1,536 dims (text-embedding-3-small) | 6,152 bytes | 6.2 GB |
| 3,072 dims (text-embedding-3-large) | 12,296 bytes | 12.3 GB |
Apply that to the free tiers. Supabase’s 500 MB holds about 81,000 vectors at 1,536 dimensions, before the index and your other tables take their share. Pinecone’s 2 GB Starter fits roughly 325,000 before metadata.
A 500-page help centre cut into 2,000 chunks fits any free tier easily. A store with 50,000 products at three chunks each needs about 920 MB at 1,536 dimensions. That’s past Supabase’s free plan. At 384 dimensions it drops to 230 MB, if search quality survives the cut.
When do you actually need a vector database?
You need one when people search by meaning and your data outgrows a list in memory.
- A chatbot on your own docs: yes, because retrieval is the whole trick. Our RAG explainer shows where the vector store sits. The RAG chatbot tutorial builds one in n8n with no code.
- A few thousand chunks: start with pgvector or even a NumPy array. You won’t need an index yet.
- Thousands of products: use hybrid search, because customers type both “warm hiking jacket” and exact SKUs.
- Agent memory: a vector store lets an AI agent in n8n recall past notes by topic. Prune it often.
- Codes, names and filters only: skip it. A normal index matches those exactly and never invents a near miss.
Frequently asked questions
Can I add vector search to a WordPress site?
Not out of the box. WordPress search matches keywords in your MySQL or MariaDB database. To search by meaning, a plugin or outside service embeds your posts and stores the vectors in a vector database, then answers queries from there. Expect a monthly cost for the embedding API or hosted index.
Can ChatGPT use my vector database?
Not by itself. An app or workflow sits in between. It embeds the question, pulls the closest chunks from your vector database and adds them to the prompt. Tools like n8n, LangChain or a custom GPT action do that wiring. The model never reads the vectors, only the text they point to.
Do I need a GPU to run a vector database?
No. Search runs comfortably on a normal CPU, and our test answered queries in well under a millisecond on one core. Embedding is the heavier job. A CPU embedded about 98 sentences a second for us, which is fine for thousands of documents. Millions are faster through a hosted embedding API.
What happens if I switch embedding models?
You have to re-embed all your data. Vectors from two models live in different spaces, so comparing them returns nonsense. Plan for it now. Keep the original text next to every vector and record which model made each one. Then a migration is a script, not a rebuild.
Is my data safe in a hosted vector database?
Treat it like any hosted database holding the same text, because the original text usually sits beside each vector. Check the region, encryption and deletion terms. Researchers have rebuilt readable text from embeddings alone, so don’t treat vectors as anonymised data either.
How many dimensions should my embeddings have?
Use your model’s default first, then test smaller sizes. More dimensions cost more storage and memory. 1,536 dimensions take four times the space of 384. Some models, including OpenAI’s text-embedding-3 family, let you request shorter vectors. Measure search quality on your own questions before cutting.
What is a vector database used for besides chatbots?
Recommendations, duplicate detection, image search and spotting unusual activity all rely on finding similar items. A shop shows lookalike products. A support team merges duplicate tickets. A photo library finds pictures that resemble an upload. Any job you can phrase as more like this fits.
The bottom line
So, what is a vector database? It’s storage that finds the closest meaning instead of the exact words. In our test that turned 3 right answers into 7.
For most sites, pgvector in the Postgres you already run is the right first step. Move to Pinecone or Qdrant once your vectors run into the millions. Whatever you pick, pair it with keyword search. Semantic search always returns something, even for a product that doesn’t exist.
Next step: write down 20 questions your users really ask. Run them through a free tier and count how many come back right.



