arrow_backGuides / Vector Databases
Updated July 2026 13 min read Intermediate

Vector DB — the memory
of RAG and AI agents

Every RAG system and every agent with long-term memory relies on a vector database — the place where "knowledge" is stored as vectors and retrieved by meaning similarity. In this guide: how it really works, a comparison of Pinecone, Qdrant, Weaviate and pgvector, and how to choose the right one for your project.

Pinecone
Managed
Qdrant
Rust, fast
Weaviate
Hybrid
pgvector
Postgres

What a vector database is and why you need one

A regular database searches for an exact match: "give me all records where city = Tel Aviv". A vector database searches for meaning similarity: "give me the documents closest in meaning to this question". This is exactly whatRAG and agent memory need — to find relevant knowledge even when it was not written in the same words.

The magic works through embeddings: a model turns each piece of text into a vector of numbers (a list of, say, 1536 values) that represents the meaning. Texts similar in meaning get vectors close together in space. The vector DB stores these vectors and can quickly retrieve the ones closest to a query.

menu_book
RAG over documents
memory
Agent memory
recommend
Recommendations & search

How similarity search works — briefly

The process splits into two stages: indexing andquerying.

content_cut
1. Chunking
You split each document into reasonably sized chunks. Good chunking is half of RAG success.
tag
2. Embedding
Each chunk passes through an embedding model and becomes a vector. You store it in the DB together with metadata (source, date).
travel_explore
3. ANN Search — nearest neighbors
At query time, the DB also converts the query into a vector and searches for the k nearest, using an ANN algorithm (e.g. HNSW) that dramatically accelerates the search across millions of vectors.
info
HNSW — why it is fast

Searching for the exact nearest vector among a million vectors is too slow. HNSW (Hierarchical Navigable Small World) builds a layered graph that lets you find the nearest neighbors approximately at enormous speed, with 95%+ accuracy. Almost every modern vector DB uses it.

Comparison table — at a glance

Store Model Best for
PineconeManaged onlyFast setup with no DevOps
QdrantOpen source + cloudPerformance & self-host
WeaviateOpen source + cloudHybrid search & modules
pgvectorA Postgres extensionYou already have Postgres
ChromaOpen source, embeddedPrototyping & learning

The leading tools — who each suits

How to choose — a decision tree

school
Learning / local prototype?
Chroma or pgvector. Simple and immediate.
storage
Already using Postgres?
pgvector. Do not add a system unless you must.
bolt
Millions of vectors, performance-critical?
Qdrant (self-host/cloud) or Pinecone (managed).
rocket_launch
Want zero maintenance?
Pinecone. Fully managed, scales on its own.

Tips for retrieval quality

lightbulb
Do not start from the tool — start from the RAG

RAG quality is determined far more by chunking, the choice of embedding model and reranking — less by which vector DB you chose. Almost all the tools use the same HNSW and give similar results. Start simple (pgvector/Chroma), and upgrade only when scale demands it. See the full RAG guide.