Guide
What Is a Vector Database?
A vector database stores text, images and other data as embeddings — lists of numbers that capture meaning — so you can search by meaning instead of exact words. It is the memory behind RAG apps and AI agents. Here is how it works, when you need one, the popular options, and a tested Python example.
By Abdul Rahman Azam, founder of AI Season · Updated
Key facts
| What it stores | Embeddings (vectors) plus the original content and metadata |
|---|---|
| What it does | Finds the most similar items to a query — semantic search |
| Used for | RAG, AI agent memory, recommendations, duplicate detection |
| Popular options | Chroma, Pinecone, Qdrant, Weaviate, Milvus, pgvector |
| Example | Chroma in Python — runs locally, no account needed |
What is a vector database?
A normal database finds rows that match exact values. A vector database finds items that are *similar in meaning*. It does this by storing an embedding for each item — a vector of hundreds or thousands of numbers produced by an embedding model — and comparing vectors to find the nearest ones to your query.
That is why a search for "When is the test?" can find a note that says "The midterm exam is on 14 November" even though they share no words: their embeddings are close together.
How it works
- Embed — each document or chunk is turned into a vector by an embedding model.
- Store — the vector is saved with the original text and metadata such as source, date or topic.
- Index — the database builds an approximate-nearest-neighbour index so search stays fast across millions of vectors.
- Query — your question is embedded with the same model, and the database returns the closest vectors, usually by cosine similarity or distance.
- Filter — metadata filters narrow results, for example to one course or one user.
Try it: a vector database in Python
Chroma is an open-source vector database that runs inside your Python program, so it is ideal for learning. Install it with pip install chromadb; on first run it downloads a small default embedding model.
import chromadb
client = chromadb.Client() # in memory; chromadb.PersistentClient(path="db") saves to disk
notes = client.create_collection("uni_notes")
notes.add(
ids=["n1", "n2", "n3", "n4"],
documents=[
"The midterm exam is on 14 November in Hall B.",
"Library hours are 8 am to 10 pm on weekdays.",
"Hostel fees must be paid before the semester starts.",
"The AI society meets every Thursday after classes.",
],
metadatas=[{"topic": "exams"}, {"topic": "library"}, {"topic": "fees"}, {"topic": "societies"}],
)
results = notes.query(query_texts=["When is the test?"], n_results=2)
for doc, distance in zip(results["documents"][0], results["distances"][0]):
print(f"{distance:.3f} {doc}")0.866 The midterm exam is on 14 November in Hall B.
1.425 Library hours are 8 am to 10 pm on weekdays.Popular vector databases compared
| Option | Type | Good for |
|---|---|---|
| Chroma | Open source, embedded or server | Learning, prototypes and small apps |
| Pinecone | Fully managed cloud service | Production without running servers |
| Qdrant | Open source, self-host or cloud | Fast filtering and production workloads |
| Weaviate | Open source, self-host or cloud | Hybrid keyword + vector search |
| Milvus | Open source, distributed | Very large collections |
| pgvector | PostgreSQL extension | Adding vectors to a database you already use |
| FAISS | Library, not a full database | Fast similarity search inside your own code |
For a student project, start with Chroma or pgvector. Move to a managed or distributed option only when data size or traffic demands it.
Vector databases in RAG and AI agents
In RAG, you chunk your documents, store their embeddings, and at question time retrieve the most relevant chunks and give them to the LLM with an instruction to answer only from them and cite them. That is how chatbots answer from a university handbook or company policy instead of guessing. The full pipeline is in RAG for AI agents.
In AI agents, a vector database can also serve as long-term memory — past conversations or user preferences retrieved when relevant. If LLMs themselves are new to you, start with what an LLM is.
Learn RAG and vector databases live
The AI Season bootcamp teaches embeddings, vector databases and RAG as part of building real AI agents — 12 live sessions over 6 weeks, explained in Urdu, coded in English. Cohort 02 starts 1st January 2027.
Frequently asked questions
What is a vector database in simple words?
A database that stores the meaning of text or images as lists of numbers, so it can find items that are similar in meaning to your search, not just items with the same words.
Why do LLM apps need a vector database?
LLMs do not know your private or recent documents. A vector database finds the relevant passages quickly so they can be given to the model, which lets it answer accurately and cite sources.
Which vector database is best for beginners?
Chroma, because it runs inside Python with no account or server. pgvector is a good next step if you already use PostgreSQL.
Is FAISS a vector database?
FAISS is a similarity-search library rather than a full database: it indexes and searches vectors very fast, but storage, metadata and updates are up to you.
What is an embedding?
A list of numbers produced by an embedding model that represents the meaning of a piece of content. Similar meanings produce vectors that are close together.