Skip to content
AI Playbooks · 10 min read

Vector Database for Beginners: The Playbook on Storing and Searching Embeddings

Vector database for beginners: learn how vector search works, pick between a library, pgvector or a hosted service, and test results in six simple plays.

Meera, a developer in Pune, had a small win last month. She turned 300 help-centre articles into embeddings, and her search finally understood that "refund" and "money back" mean the same thing. Her team loved it.

Then the product grew. Now there are 40,000 articles, chat logs and product notes, and every search takes seconds. Her list of numbers lives in one big file that the app reads from top to bottom each time. Her lead asks a simple question: "Do we need a vector database?"

This chapter is a vector database for beginners playbook. You will learn what a vector database is, how it finds similar things fast, and how to pick and test one, in plain words, by following Meera.

Last verified: 22 November 2026. AI tools change fast; check the linked sources for anything newer.

Who this is for: developers, students and product people who know what an embedding is (or have read our embeddings playbook) and now need to store and search many of them. Time needed: about 30-40 minutes.

What is a vector database, in simple words

First, a quick reminder. An embedding is a list of numbers that captures the meaning of a piece of text, an image or a sound. Texts with similar meaning get similar lists. Each list is called a vector.

A vector database is a place that stores these vectors next to the original data and answers one question very fast: "Which stored items are closest to this one?" That is called similarity search, or nearest neighbour search.

Think of a huge library with no catalogue: to find books like yours, you walk every shelf. That is Meera’s file today. A vector database is the librarian who has grouped similar books on nearby shelves and walks straight to the right corner.

The precise version: a vector database stores vectors with their metadata and uses a special index to return the top matches by a distance measure, without comparing the query against every stored vector.

How "close" is measured

The database compares two vectors with a distance measure. The most common one for text is cosine distance, which checks whether two vectors point in the same direction. Others are Euclidean (L2) distance, the straight-line gap, and inner product. Use the one your embedding model’s documentation recommends.

What a vector index does

Without an index, the database checks every vector. This is called exact search: perfect results, but slow when you have millions of items.

A vector index is a shortcut. The popular kind is HNSW (Hierarchical Navigable Small World), a map of links between nearby vectors that search can hop along, like asking friends of friends until you reach the right person. Another kind, IVFFlat, splits vectors into groups and searches only the closest groups.

These shortcuts are approximate nearest neighbour (ANN) search. They are much faster, but now and then they miss a true best match. The share of true matches they find is called recall. According to the pgvector README, HNSW gives a better speed-to-recall balance but builds more slowly and uses more memory than IVFFlat.

The playbook at a glance

Here is the whole vector database for beginners path in six short plays.

  1. Check whether you really need a vector database yet.
  2. Pick one embedding model and one distance measure.
  3. Choose where your vectors live: a library, a database extension or a hosted service.
  4. Store vectors with metadata and add an index.
  5. Search with filters, and know their catch.
  6. Test search quality before and after every change.

Play 1: Check whether you need a vector database

Goal: do not add a new system before it earns its place.

  1. Count your items. A few thousand vectors can be searched exactly, straight from memory, in milliseconds.
  2. Time your current search on real queries.
  3. List what you need beyond search: saving data safely, updates, filters by user or date, many apps sharing the data.
  4. If search is slow, or you need those extras, move on to Play 2.

Meera timed her search at well over a second per query on 40,000 items (her own illustrative measurement), and she also needed filters by product. That settled it.

You are done when: you can say in one sentence why you need a vector database, with a number behind it.

Play 2: Pick one embedding model and one distance measure

Goal: make every vector comparable.

  1. Choose one embedding model for both your stored items and your queries. Vectors from two different models cannot be compared.
  2. Write down its dimension, the length of each vector (for example 768 or 1,536 numbers). Your table or collection needs this number.
  3. Use the distance measure the model’s documentation recommends, usually cosine.
  4. Save the model name next to your data, so you know what to re-embed if you ever switch.

Meera kept the model from the embeddings chapter and added a model column.

You are done when: model name, dimension and distance measure are written in your project notes.

Play 3: Choose where your vectors live

Goal: pick the simplest home that fits your size and team. There are three broad options.

  1. A library inside your app (for example FAISS or an embedded Chroma). Easy to start and great for prototypes, but you handle saving and sharing yourself.
  2. A vector extension for a database you already run (for example pgvector for PostgreSQL). Your vectors sit next to your normal tables, with backups, joins and permissions you already know.
  3. A dedicated vector database or hosted service (for example Pinecone, Weaviate, Qdrant or Milvus). Built for very large collections and heavy traffic, with less to run yourself, at a monthly cost.

Meera’s team already ran PostgreSQL for orders and users. She chose pgvector so the articles, their vectors and their product tags could live in one place.

You are done when: you have picked one option and written down the reason, using the table further below.

Play 4: Store vectors with metadata and add an index

Goal: keep each vector next to what it means, then make search fast.

  1. Create a table or collection with: an ID, the original text (or a link to it), the vector, and metadata, small labels such as product, language and date.
  2. Load your items and their vectors in batches.
  3. Run a few searches with no index and save the results. This exact search is your answer key.
  4. Add an approximate index (HNSW is a good default) and run the same searches again.

Here is an illustration with PostgreSQL and pgvector, based on the pgvector README. Tiny 3-number vectors keep it readable; real ones are much longer.

CREATE EXTENSION vector;
CREATE TABLE articles (id bigserial PRIMARY KEY, product text, embedding vector(3));
INSERT INTO articles (product, embedding) VALUES ('wallet', '[1,2,3]'), ('cards', '[4,5,6]');
-- the 5 closest articles by cosine distance
SELECT id, product FROM articles ORDER BY embedding <=> '[3,1,2]' LIMIT 5;
-- make it fast on large tables
CREATE INDEX ON articles USING hnsw (embedding vector_cosine_ops);

In plain steps: switch on vector support, make a table with a vector column of a fixed size, add rows, ask for the five rows whose vectors are closest to the query vector, then build an HNSW index so that question stays fast as the table grows.

Meera loaded all 40,000 articles over a lunch break. With the index, her test searches came back in a few milliseconds (illustrative).

You are done when: your searches return the same top results with and without the index, or very nearly.

Play 5: Search with filters, and know their catch

Goal: return the closest items that also match your rules.

  1. Add filters for things the user cares about: product, language, date, or the user’s own documents only.
  2. Ask for the top results, then check how many actually come back.
  3. If a narrow filter returns too few rows, use your database’s fix. The pgvector README explains that with an approximate index the filter runs after the index scan, and suggests iterative index scans, partial indexes or partitioning.
  4. Never rely on filters alone to hide private data from the wrong user; enforce access rules in your app or database too.

Meera searched "card blocked" with the filter product = 'cards'. She asked for five results and got two. Turning on iterative scans brought back all five.

You are done when: filtered searches return the number of results you asked for.

Play 6: Test search quality before and after every change

Goal: know that search finds the right things, not just fast things.

  1. Write 20-30 real questions and, for each, the article that should come up.
  2. Measure hit rate: how often the right article appears in the top 5.
  3. Compare exact search with your index to see how much recall you trade for speed.
  4. Rerun the test after every change: new model, new index settings, new chunks. Our AI evals playbook shows how to make this a habit.

Meera’s first hit rate was 22 out of 25 (illustrative). The three misses were long articles, which she later fixed with better chunking from our RAG accuracy playbook.

You are done when: you have one hit-rate number you check after every change.

Vector database for beginners: which option to choose

OptionGood forTrade-offChoose it when
Plain list or fileUp to a few thousand itemsSlows down as it grows, no filtersYou are prototyping
Library in your app (FAISS, embedded Chroma)Prototypes, single appsYou manage saving and sharingOne app, one machine
Extension (pgvector)Teams already on PostgreSQLVery large scale needs tuningYou want vectors next to your normal data
Dedicated or hosted (Pinecone, Weaviate, Qdrant, Milvus)Large collections, heavy trafficAnother system and a billScale or speed outgrow the options above

Mistakes to avoid

  • Mixing embedding models. Vectors from different models live in different "maps". Fix: one model per collection, and re-embed everything when you switch.
  • Wrong distance measure. Using L2 when the model expects cosine quietly worsens results. Fix: match the model’s documentation and the index type.
  • Skipping metadata. Without product or user labels you cannot filter later. Fix: store labels from day one.
  • Trusting the index blindly. Approximate search can miss items. Fix: compare against exact search on your test questions.
  • Choosing by hype. A big hosted system for 5,000 items adds cost and work. Fix: start with the simplest option in the table.

How to know it is working

  • Searches on your full data return in well under a second.
  • Hit rate on your test questions stays the same or improves after adding the index.
  • Filtered searches return the number of results you asked for.

Your checklist

  • ☐ I know why I need a vector database, with a number.
  • ☐ One embedding model, its dimension and distance measure are written down.
  • ☐ I picked a library, an extension or a hosted service, with a reason.
  • ☐ Every vector is stored with its text and metadata.
  • ☐ An index is in place and checked against exact search.
  • ☐ Filters return full result lists.
  • ☐ A hit-rate test runs after every change.

Frequently asked questions

What is a vector database in simple terms?

It is a database that stores lists of numbers representing meaning, and finds the items whose numbers are closest to your query. That lets search match ideas, not just exact words.

Which vector database for beginners is easiest to start with?

For learning on your laptop, an embedded library such as Chroma or FAISS is the quickest start. If your app already uses PostgreSQL, pgvector lets you add vectors without a new system.

How is a vector database different from a normal database?

A normal database is great at exact matches, like "order ID equals 42". A vector database is built for "find things like this". Extensions such as pgvector add that second skill to PostgreSQL.

Do I need a vector database for RAG?

Not always. For a few thousand chunks, an in-memory list works. As data, users or filters grow, a vector store becomes the usual choice. See our RAG playbook for the full flow.

Is there a free vector database for beginners?

Yes. Open-source options such as pgvector, Chroma, FAISS, Qdrant, Weaviate and Milvus can be run on your own machine at no licence cost. Hosted services usually charge by usage.

Back to Meera: from slow file to fast search

Two weeks later, Meera’s help centre searches 40,000 articles in a blink, filters by product, and runs a hit-rate test every night. That is the whole vector database for beginners journey: measure, pick the simplest home, index, filter, test.

Your next step: take 20 real questions from your own users and run Play 6 on whatever search you have today. Then read how the found items reach the model in our context engineering playbook.

Sources: the pgvector README on GitHub (distance operators, HNSW and IVFFlat trade-offs, exact vs approximate search, filtering advice); Weaviate: What is a vector database (ANN indexes, recall trade-offs and common use cases). Numbers in Meera’s story are illustrative.

Leave a Reply

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

Newsletter

Get the next guide before anyone else.

One email a week with new playbooks and tutorials. No spam, unsubscribe anytime.