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.