Services

Resources

Company

/

Vector database

Vector database

A vector database is a data store built to save embeddings, which are lists of numbers that represent meaning, and to find the stored vectors closest to a query vector. Retrieval-augmented generation (RAG) apps use it to find text chunks that match a question by meaning rather than by exact keywords. It is also called a vector store.

How it works

Each record holds a vector, the source text and metadata. Comparing a query with every vector is exact but slow, so vector databases build approximate nearest neighbor (ANN) indexes such as HNSW (a layered graph) or IVF (clustered lists). These return the top matches in milliseconds at the cost of a small loss in recall.

Sizing is predictable: 1 million chunks with 1,536-dimension float32 embeddings take about 6.1 GB (1,000,000 × 1,536 × 4 bytes) before index overhead. The store can be a dedicated system or an extension such as pgvector on PostgreSQL.

Why it matters in production

Vector search is a step on the critical path of every RAG request, so its latency and recall shape answer speed and quality. Index build time, memory use and re-embedding after a model change all need planning.

See also

On the One2N blog

References

  1. pgvector: open-source vector similarity search for Postgres

  2. Approximate nearest neighbor search with HNSW graphs (Malkov and Yashunin, 2016)

Scatter plot of a vector database: grey dots are stored embeddings, and a yellow star is the question's vector. Green lines join it to the top 3 matches an ANN index returns in milliseconds. A red dot sits closer to the question than any of them but was missed, the small recall loss of approximate search. Beside it, the sizing sum: 1,000,000 chunks × 1,536 dims × 4 bytes ≈ 6.1 GB before index.

Putting this into practice?

Talk to One2N about our AI engineering services

Talk to One2N about our AI engineering services