What Is a Vector Database?

A vector database stores data as embeddings, lists of numbers that capture meaning, and finds the items closest in meaning to a query instead of exact matches. It is how AI apps search documents, recommend products and give language models the right context.

Try a vector search

Each dot is one of 36 short sentences, placed by its meaning. Type a question or pick a preset: the vector search finds the closest dots by cosine similarity, while the keyword search beside it only matches exact words.

Top-k:
PetsCookingWeatherMoneyFitnessTravelYour query

Vector search (by meaning)

Words the toy model understood: puppy, barking

  1. 1.00Our cat sleeps on the keyboard all day. (Pets)
  2. 1.00Best food for an older dog with sensitive teeth (Pets)
  3. 0.99What vaccines does a new dog need? (Pets)

Keyword search (exact words)

No sentence shares an exact word with your search, so keyword search finds nothing, even though the vector search found close matches.

Or search with one of the 36 sample sentences

How this demo is simplified: real embeddings come from a model and have hundreds or thousands of dimensions. Here every sentence is hand-placed in two dimensions so you can see it, and nothing you type leaves your browser.

What is an embedding?

An embedding is a list of numbers an AI model gives a piece of text, an image or a sound. The model is trained so that similar meanings get similar numbers. Picture every sentence as a point on a map: “my puppy keeps barking” lands next to “how often should I walk my dog?”, far from anything about money. Real maps have hundreds or thousands of directions instead of two, but the idea is the same.

Closeness is usually measured with cosine similarity: the angle between two vectors. A score near 1 means the same direction (very similar meaning), near 0 means unrelated. The search returns the top k closest items.

How a vector database answers a search

  1. 1. Chunk

    Split documents into short passages, such as a paragraph or a few hundred words, so each chunk is about one idea.

  2. 2. Embed

    Send each chunk to an embedding model, which returns a vector of numbers that captures its meaning.

  3. 3. Index

    Store the vectors in an index such as HNSW, a layered graph of shortcuts that finds near neighbours without comparing against every vector.

  4. 4. Query

    Embed the question with the same model and ask the index for the top k most similar vectors, usually by cosine similarity.

  5. 5. Filter and rerank

    Narrow results with metadata such as user, date or language, optionally rerank them with a stronger model, and return the original text.

HNSW in plain words: instead of comparing the question with every vector, the index hops through a few long-range links to the right neighbourhood, then through short links to the closest points. It is approximate, so it can miss a near neighbour occasionally, but it is thousands of times faster on large collections.

Vector database vs relational database

Relational databaseVector database
Finds rows byExact values: IDs, names, numbers, date rangesSimilarity of meaning between vectors
Example queryOrders where customer_id = 42Help articles most like "my card was charged twice"
AnswerEvery row that matches, or noneThe top k closest items, each with a score
IndexB-tree, hashHNSW, IVF and other approximate nearest-neighbour indexes
Best atTransactions, reports, joinsSemantic search, recommendations, RAG, deduplication

New to databases? Start with What Is a Database?

Do I even need a vector database?

Answer three questions for a starting point. Many small projects do fine with the database they already have.

How many chunks or items will you search?
What do you already run?
How do you want to run it?

Answer all three to see a recommendation.

Vector database examples compared

Well-known options as of November 2026. Licences and hosting change, so check each project before you commit.

NameWhat it isOpen sourceHostingTypical use
pgvectorPostgres extensionYes (PostgreSQL License)Self-host or most managed Postgres (Supabase, Neon, RDS, Cloud SQL)Apps already on Postgres that want vectors beside their rows
PineconeManaged vector databaseNoManaged cloud only (serverless)Teams that want zero operations at any scale
WeaviateVector databaseYes (BSD-3)Self-host or Weaviate CloudHybrid keyword + vector search with built-in embedding modules
QdrantVector database (Rust)Yes (Apache 2.0)Self-host or Qdrant CloudFast search with rich metadata filters
MilvusDistributed vector databaseYes (Apache 2.0)Self-host or Zilliz CloudVery large collections, into the billions
ChromaEmbedded vector databaseYes (Apache 2.0)In your Python or JS app, a server, or Chroma CloudPrototypes, notebooks and local RAG
LanceDBEmbedded, file-basedYes (Apache 2.0)In your app over local or object storage, or LanceDB CloudMultimodal data and serverless setups
RedisIn-memory store with vector searchYes (AGPLv3 option since Redis 8)Self-host or Redis CloudLow-latency lookups and semantic caching
ElasticsearchSearch engine with dense vectorsYes (AGPLv3 option since 2024)Self-host or Elastic CloudAdding vector search to an existing keyword search stack

Vector database questions, answered

What is a vector database in simple terms?

A vector database stores items as lists of numbers, called embeddings, that capture their meaning, and finds the items closest in meaning to a query. It answers "what is most like this?" instead of "what exactly matches this?"

What is an embedding?

An embedding is a list of numbers, often 384 to 3,072 of them, that an AI model produces for a piece of text, an image or audio. Things with similar meaning get similar numbers, so "puppy" ends up close to "dog" even though the words share no letters.

What is the difference between a vector database and a relational database?

A relational database such as Postgres finds rows by exact values, like an ID or a date range. A vector database finds items by similarity of meaning, using approximate nearest-neighbour search. Extensions such as pgvector let one database do both.

Are embeddings the same as tokens?

No. Tokens are the small pieces of text, often parts of words, that a language model reads and writes. An embedding is one vector that represents the meaning of a whole word, sentence or document. Embedding models read tokens and output embeddings.

How does RAG use a vector database?

In retrieval-augmented generation, documents are split into chunks, embedded and stored in a vector database. Each question is embedded too, the closest chunks are retrieved, and they are added to the prompt so the AI answers from your documents.

How much does a vector database cost?

It can cost nothing: pgvector, Qdrant, Weaviate, Milvus and Chroma are open source, and several managed services have free tiers. Costs grow with the number of vectors, their dimensions and query volume, so a few hundred thousand chunks usually fit on one small server.

See how retrieval fits into a full AI answer in What Is RAG? This page calls no AI or embedding service and stores nothing.

Building agents that remember and search your docs? Explore Tornic to turn your Claude Code, Codex or Cursor subscription into repeatable, reviewable workflows.