What is a vector database?

A vector database is a data management system that stores embedding vectors with their metadata and quickly finds the records closest to a query vector through approximate nearest neighbour search.

It differs from a vector index in scope: the index is the data structure that enables similarity search, while the database is the full system managing the index, metadata, updates and access control. It is not only for document search; it can store any kind of vector data.

Topic
Embeddings, document processing and RAG
Also known as
Vector store, vector DB

How a vector database works

  1. Document chunks are turned into vectors by an embedding model and added with metadata such as source, date and permissions.
  2. Vectors are indexed with a structure such as Hierarchical Navigable Small World that finds approximate nearest neighbours without scanning every record.
  3. Cosine similarity or distance between the query vector and records is computed and the closest results are returned.
  4. Metadata filtering narrows results by conditions such as permission, department or date.

In more detail

Hybrid search and reranking

Dense vector similarity alone often misses exact keywords, product SKUs, error codes or statutory article numbers (e.g., 'Article 14/2-b'). Production enterprise RAG systems therefore rely on hybrid search, combining dense vectors with sparse/lexical retrieval (BM25 or SPLADE) fused via Reciprocal Rank Fusion (RRF), often followed by a cross-encoder reranker.

Vector quantisation and disk-based indexing

At scale, holding raw FP32 vectors and HNSW graphs entirely in RAM becomes expensive. Vector databases use Scalar Quantisation (INT8), Product Quantisation (PQ) or Binary Quantisation (BQ) alongside disk-backed graph indexes such as DiskANN to cut memory footprints by 4x to 32x, often pairing compressed search with high-precision rescoring from disk.

Pre-filtering and post-filtering in HNSW indexes

Metadata filtering interacts critically with graph-based ANN indexes like HNSW. Naive post-filtering can exhaust the top-k candidate list and return zero results when a filter is selective, whereas pure pre-filtering can degrade graph connectivity; modern vector databases use single-stage filtered graph traversal (inline predicate evaluation) to preserve both recall and access-control boundaries.

Deletes, updates and index compaction

Graph indexes such as HNSW do not immediately reclaim space on deletion; deleted records are marked as tombstones until periodic background compaction or segment rebuilding runs. In regulated deployments, teams must account for compaction overhead and confirm physical erasure when fulfilling data-deletion requests.

Commonly confused terms

TermHow it differs
Relational database with a vector extension (pgvector)Relational databases with vector extensions (such as PostgreSQL with pgvector) store vectors alongside transactional tables with ACID guarantees and SQL joins, which works well at small-to-medium scale; dedicated vector databases are purpose-built for distributed sharding, billion-scale ANN throughput and specialised vector compression.
Full-text search engine (BM25)A traditional full-text search engine (e.g., BM25/inverted index) matches exact keywords, codes and morphological stems, whereas a vector database matches semantic proximity via dense embeddings; modern enterprise RAG combines both in hybrid search.

Why a vector database matters for on-premises AI

In in-house RAG, chunk vectors stay on the organisation's own servers; vectors can reveal information about source text, so keeping them inside matters. Combined with permission-aware retrieval, metadata filtering means users never see records they are not allowed to. For large archives, memory and disk planning drive cost; vector dimension and record count are calculated together. If the embedding model changes, the whole collection is re-embedded.

This page gives general information and is not legal advice.

ON-PREMISES EXAMPLE

A public body stores vectors of its regulatory archive chunks with departmental permissions in a vector database on its own servers; each question retrieves only permitted chunks.

Common questions

Is a separate vector database required instead of an existing relational one?

No. At small and medium scale a relational database with a vector extension can be enough; very large collections and heavy query loads favour a dedicated vector database.

Can a vector database run on in-house servers or a closed network?

Yes. Many vector databases run on the organisation's own hardware and in environments without internet access.

Sources

Related page on this site: Related FAQ · In the glossary: Glossary, R to Z

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.