Vector database

The Citead team, updated

In short. A vector database stores embeddings and retrieves nearby vectors using a distance or similarity metric.

Definition: A vector database stores embeddings, numerical representations of content, and retrieves records whose vectors are closest to a query vector. Similarity search uses a distance or similarity metric to find nearest neighbors, the records with the closest vectors.

Key facts

  • As of 17 October 2026, the pgvector README documents a PostgreSQL extension that stores vectors alongside other data and defaults to exact nearest neighbor search.
  • Microsoft's August 2026 vector search overview illustrates conceptual matching with “dog” and “canine”, which differ in wording but share meaning.
  • Microsoft's January 2026 vector ranking documentation describes exhaustive search across all vectors and approximate search through a graph.

How are vectors stored and queried?

The pgvector getting started example creates a vector column with three dimensions, inserts two vectors, and requests up to five nearest neighbors:

CREATE EXTENSION vector;
CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));
INSERT INTO items (embedding) VALUES ('[1,2,3]'), ('[4,5,6]');
SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5;

The <-> operator measures Euclidean distance, also called L2 distance. The query orders rows by increasing distance from the supplied vector. These are the documentation's example vectors. The extension also supports cosine distance through <=>.

How does content become a search result?

Microsoft's overview describes separate indexing and query workflows. An embedding model converts content into vectors for storage. At query time, the application converts the request into a query vector. Similarity search returns documents associated with nearby vectors.

The ranking documentation specifies that document and query vectors come from the same embedding model, placing them in the same embedding space: the numerical space in which distances are compared.

For a website knowledge base, Microsoft identifies vector storage as a source of grounding data for retrieval-augmented generation (RAG), an architecture that supplies retrieved material to a model generating an answer. Microsoft's RAG overview describes this handoff in its classic RAG pattern. Its overview also describes hybrid search, which combines vector and keyword queries and merges their results.

What changes with an approximate index?

Exact search compares the query against all stored vectors. Microsoft's ranking documentation describes this exhaustive approach as computationally intensive and useful for building reference results.

Approximate nearest neighbor search reduces the search space to trade some accuracy for faster retrieval. Hierarchical Navigable Small World (HNSW) is an approximate algorithm that organizes vectors into a graph and follows connections to find nearby candidates. Its parameters affect recall, latency and memory use. Recall here measures how many of the exact nearest neighbors the approximate search retrieves.

The pgvector indexing documentation warns that adding an approximate index can change query results. Its monitoring guidance compares approximate results with exact search to check recall.

FAQ

Can a vector search also use keywords?

Yes. Microsoft's overview describes hybrid search as vector and keyword search in the same request, with results merged into a single response.

Why can a filtered query return fewer matches?

The pgvector filtering documentation explains that approximate indexes apply filtering after scanning the index. Iterative index scans can search more of the index when additional results are needed.

Sources

  1. pgvector, “pgvector README”, undated
  2. Microsoft, “Vector search in Azure AI Search”, 5 August 2026
  3. Microsoft, “Relevance in vector search”, 21 January 2026
  4. Microsoft, “Retrieval-augmented generation (RAG) in Azure AI Search”, 4 August 2026

Check how a page reads to answer engines. Open the GEO score analyzer

Test a page and see what to fix first

The analysis usually takes less than 10 seconds and needs no account.

400,000+ pages scored in the public benchmark