Back to Basics

Why Does AI Need a Vector Database?

Why Does AI Need a Vector Database?
AI Tutorials Team 17 March 2026

A vector database stores embeddings and answers one question quickly: which of these stored items is closest in meaning to this one. It is a standard component in any system that answers questions about a large document collection, and it is also the component most often added to projects that do not need it.

Why not use an ordinary database?

Because conventional databases are built to find exact matches. Give one an identifier or a name and it uses an index to jump straight to the row. That approach does not work when the question is which of these million items is most similar to this one, since similarity has to be calculated rather than looked up.

Doing that calculation against every stored item works fine for a few thousand records and becomes unusable at a few million.

How do they make it fast?

By accepting slightly imperfect answers. Rather than comparing against everything, these systems build an index that narrows the search to a promising region, then compares within it. The usual approach organises items into a layered graph so a search can move quickly from a rough neighbourhood to a precise one.

This is called approximate nearest neighbour search, and the approximate part is deliberate. You give up a small chance of missing the true best match in exchange for results in milliseconds rather than seconds.

What else do they provide?

  • Metadata filtering. Search only within one department, date range or access level.
  • Hybrid search. Combining meaning-based matching with ordinary keyword matching, which handles product codes and names far better.
  • Updating. Adding and removing items without rebuilding the whole index.
  • Scale. Distributing across machines when the collection outgrows one.

Metadata filtering is the one that turns a demonstration into something usable in an organisation, since it is how permissions are enforced.

Which options exist?

Three broad categories. Dedicated services such as Pinecone, Weaviate and Qdrant, which are built for this and managed for you. Extensions to databases you already run, most commonly the vector support in PostgreSQL, which avoids adding a new system. And libraries such as FAISS that run inside your own application with no server at all.

The extension route is underrated. If your data already lives in PostgreSQL, adding vector search to it is usually simpler and cheaper than introducing a second database to keep in step with the first.

When do you not need one?

More often than the tooling ecosystem suggests. Below roughly ten thousand chunks, comparing against everything in memory takes milliseconds and needs no database at all. A numerical library and a file will do.

Below a few hundred documents, you may not need embeddings either. Modern context windows are large enough to hold a substantial amount of material directly, and putting the relevant documents into the prompt gives better answers than any retrieval pipeline, because nothing can be missed.

How do you decide which to use?

Start with what you already run. If your application uses PostgreSQL, the vector extension is almost always the right first choice, because it removes an entire category of synchronisation problem. Move to a dedicated service when volume, latency requirements or filtering complexity genuinely outgrow it.

The mistake worth avoiding is choosing infrastructure before you know the size of the problem. Building for millions of documents when you have four thousand adds cost and operational burden for capability you will not use.

What goes wrong in practice?

Two things, mostly. The index and the source documents drift apart, so answers cite material that has since been edited or deleted. And chunking decisions made early turn out to be wrong, which is discovered only when retrieval quality is poor and requires regenerating everything.

Neither is a database problem, which is the point worth taking away: when a retrieval system underperforms, the cause is usually upstream of the database, in how the material was split, embedded and kept current.