DroidCrunch
  • About
  • Blog
  • Categories
    • Automation
    • Tech
    • SEO
    • WordPress
    • Software
    • Hosting
    • Proxy
  • AI
    • AI Writing
    • AI Image
    • AI Tool
    • AI Video
  • Deals
  • Contact
Subscribe
No Result
View All Result
DroidCrunch
  • About
  • Blog
  • Categories
    • Automation
    • Tech
    • SEO
    • WordPress
    • Software
    • Hosting
    • Proxy
  • AI
    • AI Writing
    • AI Image
    • AI Tool
    • AI Video
  • Deals
  • Contact
Subscribe
DroidCrunch

What Is a Vector Database? How It Works and When You Need One 2026

Lokesh Kapoor by Lokesh Kapoor
November 15, 2026
3
0

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.

How a vector database works in four steps: your data, an embedding model, stored vectors, then a nearest neighbours search
The whole pipeline: your text goes through an embedding model, the vectors are stored, and a query is answered by finding its nearest neighbours.

From your documents to an answer

The same four steps run inside Pinecone, Qdrant, Chroma or Postgres with pgvector.

  1. 1
    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.

  2. 2
    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.

  3. 3
    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.

  4. 4
    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.

MetricWhat it measuresUse it when
Cosine similarityThe angle between vectors, ignoring lengthMost text search
Dot productAngle and length togetherYour model outputs normalised vectors (same ranking as cosine, a bit faster)
Euclidean (L2)Straight-line distanceImage 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 methodTime per queryTrue top-10 found
Exact (check every vector)0.94 ms100%
HNSW, search width 40 (pgvector’s default)0.061 ms96.9%
HNSW, search width 1000.188 ms99.2%
IVF, 139 clusters, search 100.089 ms85.7%
IVF, 139 clusters, search 10.020 ms51.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.

Keyword search vs vector search: keyword match finds exact words only, while a vector database finds similar ideas by meaning
Keyword search needs the same words. Vector search needs the same meaning, which is why it found refunds for a question that never said refund.

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.

vector_search.py Python
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 typedKeyword search returnedVector search returned
my parcel never showed upGift cards (matched “never”) ✗Lost parcel ✓
how do I get my money backReturns (matched “back”) ✗Refunds ✓
I forgot my login detailsPassword reset ✓Password reset ✓
stop charging my card every monthNothing ✗Cancel membership ✓
can you deliver to CanadaNothing ✗International shipping ✓
receipt for tax purposesNothing ✗VAT invoice ✓
the jacket came tornJacket product page ✗Jacket product page ✗
SKU-4471Jacket 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 databasePostgres with pgvectorDedicated vector database
Best questionWhich rows match exactly?Both, in one queryWhich items are most similar?
Joins and transactionsYesYesLimited or none
Where it shinesOrders, users, paymentsApps up to a few million vectorsVery 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:

pgvector.sql SQL
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.

OptionFree tier (15 Nov 2026)First paid stepPick it if
Postgres + pgvectorFree, open sourceYour Postgres host’s priceYou already use Postgres
Supabase500 MB databasePro, $25/monthYou want Postgres, auth and vectors in one place
PineconeStarter: 2 GB storageBuilder, $20/month flatYou want zero servers to manage
Qdrant Cloud1 GB RAM, 4 GB diskUsage-basedYou want open source with a managed option
Weaviate Cloud100,000 objectsFlex, from $45/monthYou want built-in hybrid search and hosted embeddings
Zilliz Cloud (Milvus)5 GB storageServerless, usage-basedYou expect hundreds of millions of vectors
ChromaFree locally; $5 cloud creditUsage-basedYou’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 sizeOne vector1 million vectors (raw)
384 dims (all-MiniLM-L6-v2)1,544 bytes1.5 GB
1,536 dims (text-embedding-3-small)6,152 bytes6.2 GB
3,072 dims (text-embedding-3-large)12,296 bytes12.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.

Share4Tweet2Share1Share
Previous Post

What Is Vibe Coding? How It Works, Where It Breaks and When to Use It 2026

Lokesh Kapoor

Lokesh Kapoor

I am Lokesh Kapoor who loves to write blogs, create videos and watch sci-fi movies on Netflix and Jio Cinema. DroidCrunch is my first love and a crucial part of my life.

Related Posts

What is vibe coding: a laptop showing a chat prompt on one side and the finished app it generated on the other

What Is Vibe Coding? How It Works, Where It Breaks and When to Use It 2026

November 15, 2026
298
WordPress statistics data report: a laptop dashboard showing CMS market share, version charts and a world map

WordPress Statistics 2026: Real Market Share, Versions and Plugins (Plus Our 2,000-Site Scan)

November 15, 2026
297
WordPress Multisite explained: one install running a whole network of sites from a single Network Admin

WordPress Multisite: What It Is and When to Use It 2026

November 14, 2026
297
Web hosting statistics: server racks, a globe linked to data centers and a market share chart

Web Hosting Statistics 2026: Who Really Hosts the Web (Plus Our 2,000-Site Scan)

November 13, 2026
303
Load More

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

Youtube Instagram Telegram Discord Facebook Whatsapp Twitter LinkedIn

About

DroidCrunch Logo Dark

DroidCrunch is your trusted blog & YouTube channel dedicated to SAAS lovers, WordPress enthusiasts, and Technology Freaks.

Quick Links

  • About Us
  • Editorial Policy
  • Contact Us
  • Help & Support
  • RSS Feed

© 2026 DroidCrunch - Best Place for Tech NomadPrivacy PolicyTerms & ConditionsCookie PolicyGDPR RightsAffiliate Disclosure

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In

Add New Playlist

No Result
View All Result
Subscribe
  • About
  • Blog
  • Categories
    • Automation
    • Tech
    • SEO
    • WordPress
    • Software
    • Hosting
    • Proxy
  • AI
    • AI Writing
    • AI Image
    • AI Tool
    • AI Video
  • Deals
  • Contact

© 2026 DroidCrunch - Best Place for Tech NomadPrivacy PolicyTerms & ConditionsCookie PolicyGDPR RightsAffiliate Disclosure

DroidCrunch Giveaway

Amazon Gift Card worth $15

Participate now and get a chance to become a lucky winner to receive the reward.​

Join Giveaway