What Is a Vector Database in AI?

A vector database stores embeddings, the numeric vectors that represent text, images, or other data, together with their source content and metadata, and returns the vectors most similar to a query vector quickly. Retrieval augmented generation uses one to find relevant chunks before a model answers. Many existing databases now offer vector search as a feature.

What it does

Stores vectors with context. Each record holds an embedding, the text or reference it came from, and metadata such as document, section, author, timestamp, and permissions.

Finds nearest neighbours. Given a query vector, it returns the stored vectors closest to it, ranked by a similarity measure such as cosine similarity or dot product.

Does it fast. Comparing a query against every vector is exact but slow for large collections. Vector databases build approximate nearest neighbour indexes, such as graph-based HNSW or cluster-based IVF structures, that find very close matches in a fraction of the time while occasionally missing an exact nearest result.

Filters. Combines similarity search with conditions on metadata: only this user's documents, only this repository, only content updated this year.

Maintains the index. Handles inserts, updates, and deletes while keeping search available, which is harder for vector indexes than for traditional indexes.

Scales and persists. Shards data across machines, replicates it, and stores it durably, like any production database.

Embeddings versus vector databases

The two terms are often confused. An embedding is a vector produced by a model. A vector database is the system that stores many embeddings and searches them. You can have embeddings without a vector database, for example in memory for a small prototype, and a vector database is useless without embeddings to put in it.

Why RAG uses one

Retrieval augmented generation answers questions by finding relevant material and giving it to a model as context. The retrieval step needs to search a large collection by meaning, not just keywords, and return results in milliseconds. That is exactly what a vector index provides.

The typical flow:

  1. Split documents into chunks.
  2. Embed each chunk and store it with metadata.
  3. Embed the user's question.
  4. Search for the nearest chunks, applying filters for scope and permissions.
  5. Optionally re-rank the results.
  6. Send the best chunks to the model with the question.

Why not only keyword search. Users rarely phrase questions with the same words as the documents. Vector search finds passages about the same idea in different words. Keyword search still wins for exact identifiers, which is why many systems combine both.

Why not put everything in the prompt. Larger context windows help, but sending an entire corpus with every request costs far more tokens, adds latency, and can reduce answer quality when relevant material is buried among irrelevant text.

Keeping the index in sync

When a source document changes, its old chunks must be removed and new ones embedded. Pipelines that only add records return stale and contradictory results over time. Track a document identifier and version on every chunk so updates replace rather than accumulate.

Do you need a dedicated one?

Often not at first. Many general-purpose databases now support vector columns and similarity search, including PostgreSQL through the pgvector extension, as well as several search engines and document databases. If your data already lives there, adding vectors avoids running and synchronising a second system.

Small collections can be searched with in-memory libraries, which are simple and fast for prototypes and single-user tools.

Dedicated vector databases make sense when collections are large, query volume is high, you need advanced filtering at scale, or you want managed operations for vector workloads specifically.

What matters more than the product:

  • Chunking quality, which decides what can be found.
  • Embedding model choice.
  • Metadata design, especially for permissions and freshness.
  • Keeping the index in sync as source documents change.
  • Evaluation of whether the right chunks come back.

Privacy. A vector database holds representations derived from your documents plus, usually, the original text. Treat it with the same access controls as the source data. RDK stores indexed vault content as encrypted private chunks, and agents search those chunks before calling a model.

Combining vector and structured search

Many real questions mix meaning and structure: find the design discussion about authentication from the last quarter owned by this team. Combining vector similarity with SQL-style filters, or running a structured query and a vector search and merging results, handles these better than either alone.

Frequently asked questions

What is a vector database in AI?
A database that stores embeddings, numeric vectors representing text, images, or other data, together with their content and metadata, and quickly returns the vectors most similar to a query vector. It powers semantic search and the retrieval step in retrieval augmented generation systems.
Why does RAG use a vector database?
Because RAG needs to find passages relevant to a question by meaning, across a large collection, in milliseconds. A vector index returns the chunks whose embeddings are closest to the question's embedding, with filters for scope and permissions, before the model generates an answer.
What is the difference between embeddings and a vector database?
An embedding is a vector produced by a model to represent a piece of data. A vector database stores many embeddings with their content and metadata and searches them for similarity. Embeddings are the data; the vector database is the storage and search system.
Do I need a dedicated vector database?
Not always. General databases such as PostgreSQL with pgvector, and several search engines, support vector search, and small collections can be searched in memory. Dedicated vector databases suit large collections, high query volume, and advanced filtering at scale. Start with what you already run.