Generative AI

Vector Database

A vector database is a data store built to hold embedding vectors with their metadata and to find the vectors nearest to a query quickly, which makes it the retrieval layer for most generative AI systems.

What is a vector database?

A vector database is a data store designed to hold embedding vectors alongside the text and metadata they describe, and to answer the question of which stored vectors are closest to a given query vector. A conventional database finds rows where a column equals a value. A vector database finds the hundred items whose meaning is most similar to a sentence. That operation, called vector search or approximate nearest neighbor search, is the retrieval step in retrieval-augmented generation (RAG).

Exact comparison against millions of vectors is too slow for interactive use, so vector databases build index structures that trade a small loss in accuracy for large gains in speed. They also support filtering by metadata, so a search can be restricted to documents from one department, one date range, or one set of permitted groups before similarity is computed.

Types of vector database

Three forms are common. Dedicated vector databases are built around the index and scale to very large collections. Extensions to established databases, such as vector columns in PostgreSQL or search engines that added vector fields, let a team keep one system of record and one set of backups. Embedded libraries run inside the application process and suit small collections and proofs of concept. For most mid-sized companies, a vector extension to a database they already operate is the lowest-risk starting point.

Vector database in practice

A managed service provider indexes five years of resolved tickets, runbooks, and vendor documentation so technicians can ask how a problem was solved before. Each chunk is stored with its client, system, and resolution date. When a technician asks about a backup failure, the search is filtered to that client’s environment and the relevant product, then ranked by similarity. The database also enforces that a technician sees only the clients assigned to them, which the firm’s contracts require.

What to watch for

  • Metadata and permission filters must be applied before or during the similarity search, because filtering afterward can return an empty result or score items that should have been excluded.
  • Index parameters trade recall for speed, so measure whether the right chunks are actually returned rather than trusting default settings.
  • Plan for updates and deletions, since some indexes handle appends well but degrade or require rebuilding when many items change.
  • The vector database holds a copy of your documents in a new place, so it needs the same backup, encryption, and access controls as the source systems.

← Back to AI Glossary