What is a vector database?

A vector database stores lists of numbers that describe the meaning of text, images or sounds, and finds the stored items closest to a query. It is the retrieval engine behind semantic search and retrieval-augmented generation.

What is an embedding?

A fixed-length list of numbers produced by a model so that similar inputs land near each other. Two product descriptions that mean the same thing in different words produce vectors pointing in nearly the same direction. Typical embedding models output 384, 768 or 1,024 dimensions. Once everything is a vector, finding related items becomes a geometry problem: which stored vectors are closest to this one?

How is closeness measured?

Usually by cosine similarity, which compares directions, or by inner product and Euclidean distance. Many embedding models produce normalised vectors, in which case cosine and inner product give the same ranking. Use the metric the embedding model was trained for; the model card says which.

Why not just compare every vector?

Because it gets slow. A brute-force search over ten million vectors of 768 dimensions reads about 30 GB of float32 values per query. That is fine for a nightly batch job but far too slow for interactive search. Vector databases build approximate nearest neighbour indexes that check a small fraction of vectors and still return almost all of the true nearest results.

Index typeHow it worksMemoryGood for
Flat (exact)Compare against every vectorRaw vectors onlySmall sets, ground truth
HNSWLayered graph of neighboursVectors plus graph linksFast, high recall, in memory
IVFClusters, search only nearby onesVectors plus centroidsLarge sets, tunable speed
IVF with product quantisationCompressed vector codesA fraction of raw sizeVery large sets, some recall loss

What is recall, and why does it matter?

Recall is the share of the true nearest neighbours that the approximate index returns. An index tuned to 95 percent recall misses one in twenty relevant items, which may be fine for recommendations and less fine for legal search. Index parameters, such as HNSW's ef_search or IVF's number of probed lists, trade speed for recall. Measure recall against an exact flat search on a sample before going live.

Do I need a separate database product?

Not always. PostgreSQL with the pgvector extension stores vectors next to ordinary columns, supports HNSW and IVF indexes, and lets one query filter by customer, date or language and rank by similarity. Dedicated engines such as Qdrant, Milvus and Weaviate add features for very large collections, sharding and hybrid keyword plus vector ranking. Search engines like OpenSearch and the newer releases of several open-source search servers include vector fields as well.

CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE passages (id bigserial PRIMARY KEY, doc_id int, lang text, body text, emb vector(768));
CREATE INDEX ON passages USING hnsw (emb vector_cosine_ops) WITH (m = 16, ef_construction = 128);
SET hnsw.ef_search = 80;
SELECT id, body FROM passages WHERE lang = 'en' ORDER BY emb <=> $1 LIMIT 8;

How much memory does a vector index need?

Start from raw size: vectors times dimensions times four bytes. Ten million 768-dimension vectors take about 30.7 GB in float32. HNSW adds graph links, roughly m x 2 x 4 bytes per vector at the base layer, around 128 bytes each at m = 16, so about 1.3 GB more. Keep the index in memory for low latency, and leave room for the operating system and the database's own caches. Storing vectors as half precision or with quantisation halves or quarters the footprint at a small recall cost.

Which server suits a vector database?

One with plenty of memory and fast cores; vector search runs very well on CPUs with AVX-512. For a few million vectors, ESSENTIAL-L with 128 GB DDR5 is comfortable. Tens of millions fit on ESSENTIAL-8 with 256 GB DDR4. Our machines are CPU only, which suits retrieval: embedding generation for queries runs on the same cores, as the CPU inference for AI models page describes. See also PostgreSQL servers and OpenSearch clusters.

Machines with memory for vector indexes

ModelProcessorCoresMemoryDrivesPortPer month
ESSENTIAL-MAMD Ryzen 9 9900X1264 GB2x 512 GB SSD NVMe1 Gbps unmetered$70.80
ESSENTIAL-LAMD Ryzen 9 9950X16128 GB2x 960 GB SSD NVMe1 Gbps unmetered$106.20
ESSENTIAL-8AMD EPYC 753232256 GB2x 480 GB SSD SATA1 Gbps unmetered$126.60
ESSENTIAL-9AMD EPYC 764248256 GB2x 480 GB SSD SATA1 Gbps unmetered$153.00
ENTERPRISE-a3 2026AMD EPYC TURIN 935532128 GB2x 1.92 TB SSD NVMe5 Gbps unmetered$481.80

Related pages

PostgreSQL servers

Run PostgreSQL on dedicated hardware: current versions from the project repository, memory settings, NVMe planner costs, replicas, pgBackRest and failover.

Read more

CPU inference for AI models

Run quantised language and vision models on many-core EPYC and Xeon 6 processors with AVX-512 and plenty of DDR5.

Read more

OpenSearch clusters

Run OpenSearch for search and logs on bare metal: heap and mmap limits, security plugin setup, shard sizing, index state management and node roles.

Read more

Meilisearch servers

Self-host Meilisearch for site and app search: master and API keys, index settings, memory-mapped storage, indexing speed, snapshots and dumps.

Read more

Questions and answers

What is a vector database used for?

Finding items with similar meaning: semantic search, recommendations, duplicate detection and retrieval for language model answers.

What is HNSW?

A graph-based index for approximate nearest neighbour search that is fast and accurate but keeps vectors and links in memory.

Can PostgreSQL be a vector database?

Yes. The pgvector extension adds vector columns and HNSW or IVF indexes, combined with normal SQL filters.

How much RAM do ten million embeddings need?

At 768 dimensions in float32, about 31 GB for the vectors plus roughly 1.3 GB for an HNSW graph, before caches.

Do vector databases need a GPU?

No. Search runs well on modern CPUs with AVX-512, and our machines are CPU only.