What is a vector database? A beginner’s guide
Embeddings, similarity search and the databases built for them, explained in plain English: what they do, when you need one, and how the popular options compare.
A vector database stores data as embeddings, lists of numbers that capture meaning, and quickly finds the items most similar to a query. It powers semantic search, recommendations and RAG chatbots, where you need to find text by meaning rather than exact keywords. For small projects, a simple library or a Postgres extension is often enough.
Vector databases became popular very quickly with the rise of AI assistants, and the jargon can make them sound more complicated than they are. This guide explains the idea step by step, then compares the common options and helps you decide whether you need one at all.
What problem does a vector database solve?
Traditional search matches words. Search a travel site for “cheap flights to Goa” and a keyword system looks for those exact words. A page titled “Budget airfare for your Goa holiday” might be missed, even though it is exactly what you wanted.
The problem gets worse with synonyms, spelling variations, Hinglish (“Goa ka sasta ticket”) and questions phrased differently from how the answer is written. People search by meaning; keyword systems search by spelling.
Vector search closes that gap. It compares meaning, so “cheap flights” and “budget airfare” land close together.
What is an embedding?
An embedding is a list of numbers that represents the meaning of a piece of content. An embedding model reads a sentence, a paragraph, an image or a product listing and outputs a vector, typically hundreds or thousands of numbers long.
Think of a map of India. Every city has two numbers, latitude and longitude, and cities that are close on the map have similar numbers. An embedding does the same thing for meaning, but instead of two dimensions it uses hundreds. Sentences about similar things end up with similar numbers, so they sit near each other in that space.
The embedding model matters as much as the database. A vector database only stores and searches the numbers; it is the model that decides what counts as “similar”. For Indian languages, choose an embedding model that has actually been trained on them.
How does similarity search work?
To answer a query, you turn the query into an embedding with the same model, then look for the stored embeddings closest to it. Closeness is usually measured with cosine similarity, which checks whether two vectors point in the same direction, or with simple distance.
Comparing a query against every stored item works fine for a few thousand items. At millions, it becomes too slow. So vector databases use approximate nearest neighbour (ANN) indexes, which find very close matches without checking everything.
A popular one is HNSW (Hierarchical Navigable Small World). Picture India’s road network: to get from Kolkata to a village near Pune, you take a highway most of the way, then state roads, then local lanes. HNSW builds layers of connections in the same spirit, so a search jumps quickly across the space and then narrows down. It gives up a tiny amount of accuracy for a very large gain in speed.
What does a vector database add beyond an index?
An index alone finds similar vectors. A database adds the things you need to run it in a real application:
How do the popular options compare?
You will meet these names in almost every tutorial. They fall into three groups: libraries, extensions to databases you already use, and dedicated vector databases.
There is no single best choice. For a learning project, Chroma or FAISS is simplest. For a production app that already uses Postgres, pgvector keeps everything in one place.
Where are vector databases used?
Do you actually need a vector database?
Often, not at first. A few questions help:
What does a simple example look like?
Imagine building a question-answering assistant for a college’s admission FAQs.
That is the core of most RAG systems. When to add retrieval, and when a better prompt or fine-tuning is the right tool instead, is covered in our guide to fine-tuning vs RAG vs prompt engineering.
What mistakes should you avoid?
If you want to build this end to end, Program Zero’s LLM phase covers embeddings, vector databases such as FAISS, Chroma and Pinecone, and a full RAG pipeline, after earlier phases on databases and programming. For how retrieval fits into assistants that also take actions, see our guide to agentic AI.
Want to learn this live, with mentors?
In Program Zero you build embeddings, vector search and a full RAG pipeline yourself, inside an 18-month live programme in AI, LLMs and full-stack development. ₹5,999 for all 18 months; the batch starts 9 January 2027.
Frequently asked questions
Related reading
We teach this, live
Every article here comes from something we teach. Sit in on a free masterclass and judge the mentors yourself.