Intermediate

Vector databases: the search memory behind AI apps

A vector database stores embeddings, the lists of numbers that capture what a piece of text means, and can find the ones most similar to a query in milliseconds. It is the hidden search engine behind most assistants that answer from documents.

Data as of October 22, 2026

Key figures

LevelIntermediate

What it is, simply

A traditional database looks for exact matches: a name, a date, an order number. A vector database looks for similarity. It stores embeddings, vectors of numbers that represent the meaning of content, and answers the question “which items are closest to this one?”

To measure closeness, it uses distance formulas. The pgvector documentation, for example, lists Euclidean distance, inner product and cosine distance, among others. Rather than comparing a query against every vector one by one, it builds approximate search indexes. One of the most widely used, HNSW, comes from a paper by Malkov and Yashunin posted to arXiv in 2016; pgvector supports it alongside IVFFlat.

A concrete example

A customer support team has thousands of help articles. Each article is split into paragraphs, each paragraph is turned into an embedding and saved in the database along with its title and link. When a customer writes “tracking says delivered but nothing arrived”, the message is converted too, and the database returns the closest paragraphs, even if they are worded as “missing package”. Those passages are then passed to the model: the classic RAG pattern.

Why it matters

Without this building block, an assistant would have to reread all your documents for every question, which is slow, expensive and often impossible beyond the context window. Vector databases also serve as long-term memory for agents and power semantic search. If you are starting to build agents, our Build learning path shows where this piece fits among the others.

Common mistakes

  • Forgetting filters. Similarity alone isn’t enough: you often need to filter by date, language or access rights, or an employee might see an excerpt they shouldn’t.
  • Neglecting how text is split. Chunks that are too long drown the information; too short and they lose context. Chunking has a big impact on quality.
  • Thinking the database “understands”. It compares numbers; the understanding comes from the embedding model you chose.
  • Switching embedding models without recomputing everything. Old vectors can’t be compared with new ones.

Related terms: embedding, RAG, semantic search, hybrid search, reranking.

Related terms

Full glossary

Frequently asked questions

Do I need specialized software, or will a regular database do?

Both options exist. There are databases built for vectors, and extensions that add the capability to an existing database: pgvector, for instance, describes itself as open-source vector similarity search for Postgres. For a modest project, sticking with a database you already know is often simplest.

Are the results exact?

To stay fast, most vector databases use approximate nearest-neighbor search. It trades a little accuracy for a lot of speed, so a relevant passage can occasionally be missed. Index settings let you tune that trade-off.

How many documents before I need one?

There is no official threshold. For a few files, sending the text straight to the model can be enough. A vector database pays off when your content exceeds what the model can read at once, or when many questions need fast answers.

Data sources

Data as of October 22, 2026

Report an error

Does a figure, a date or a fact look wrong? Tell us: every report is checked.