Skip to content
Technology transformation expertise firm · ARDIANE Group Innovate, secure, succeed

Glossary

Vector database: definition and how it works

Domains

Data · Artificial intelligence

In brief

A vector database is a system that stores numerical vectors, called embeddings, and retrieves those closest to a query vector according to a distance measure. A term of common usage, the vector database is used for similarity search over texts, images or other content, by means of so-called approximate indexes.

Page contents

Definition of the vector database

A vector database is a system that stores numerical vectors and retrieves, for a query vector, those closest to it according to a distance measure. These vectors, called embeddings, are calculated by a model from a piece of content: a passage of text or an image. The model is trained so that two pieces of content with similar meaning receive similar vectors.

The term is one of common usage. It covers databases designed for this purpose and vector functions added to relational databases or to search engines.

What similarity search is for

An SQL query selects rows by comparing values. A full-text engine retrieves the documents containing the requested words. A vector database answers a different request: which content resembles this one?

It retrieves passages close to a question worded differently, similar images or near-duplicates. Its use in a document assistant is described in our entry on RAG.

Distance, nearest neighbours and approximate indexes

Proximity is calculated using a distance measure, for example cosine distance, the dot product or Euclidean distance.

Exact search compares the query with every stored vector. Its result is complete and its cost grows with the number of vectors. Approximate nearest neighbour (ANN) search relies on an index that limits comparisons. It responds faster and may miss some neighbours: the pgvector documentation speaks of recall traded for speed, the OpenSearch documentation of accuracy given up in exchange for lower latency.

Two families of indexes appear in the pgvector documentation as well as in that of Milvus. HNSW, described by Yu. A. Malkov and D. A. Yashunin in a paper submitted to arXiv in 2016, organises vectors into a multi-layer graph. Inverted file indexes (IVF) divide vectors into clusters and explore only the clusters close to the query.

The database keeps metadata (source, date, access rights), which is used to filter results.

The products cited here belong to three families, according to their documentation: relational databases with a vector type (pgvector extension for PostgreSQL, MariaDB’s VECTOR type), search engines (OpenSearch, Elasticsearch) and specialised databases (Qdrant, Milvus, Weaviate).

Vector database, embedding model, full-text engine, RAG: not to be confused

Notion Role Relationship with the vector database
Embedding model Converts content into a vector It produces what the database stores; changing model means recalculating the vectors
Vector index Search structure (HNSW, IVF) The database adds durable storage, filters and updates to it
Full-text engine Retrieves documents by their words Hybrid search combines the two approaches
RAG Architecture that supplies passages to a language model The vector database is one of its building blocks

Close does not mean relevant. A nearest neighbour search returns results even when the corpus contains nothing useful, unless there is a distance threshold.

Example: finding a maintenance report

Take a maintenance department that keeps its intervention reports. A technician describes a fault: “vibration when the pump starts”. A report mentions “oscillations on start-up of the pumping unit”. The two texts share no technical term, but their embeddings are close: the database returns this report, after a filter on the equipment family.

Since the index is approximate, a useful report may be missed. The team measures recall on reference questions, by comparing the results with those of an exact search, then tunes the index. For part numbers, it adds a keyword search.

The choice between a specialised database and a vector function of the existing platform, its access rules and its operation fall within our page data platform. The assistant that uses it is the subject of our page generative AI in the enterprise.

FAQ

Frequently asked questions

Another question? Ask us

What is a vector database?

A vector database stores numerical vectors, called embeddings, which represent content such as passages of text or images. It retrieves the vectors closest to a query vector according to a distance measure, which enables similarity search. The term is one of common usage and covers specialised databases as well as functions added to existing databases.

What is approximate nearest neighbour search?

Approximate nearest neighbour search relies on an index that limits the number of vectors compared with the query, instead of going through them all. It responds faster than an exact search, but may miss some of the true neighbours. The share of true neighbours actually retrieved is called recall, and the index parameters set the trade-off between recall and speed.

Can a relational database serve as a vector database?

Yes: a relational database can serve as a vector database when its engine offers a vector type and a suitable index. According to their documentation, the pgvector extension brings exact and approximate nearest neighbour search to PostgreSQL, and MariaDB has a VECTOR type with a vector index. The choice between such a function and a specialised database depends on volumes, the filters needed and the operational skills available.

What is the difference between vector search and keyword search?

Keyword search retrieves the documents that contain the terms of the query. Vector search retrieves content whose embedding is close to that of the query, even with no word in common. Hybrid search combines the two, which suits queries that mix free wording and an exact term, such as a product reference.

A project to bring to completion?

A first conversation is enough to understand your challenge, identify the right people and tell you frankly what we can bring.