What do I look at first?
Recall, latency, memory, and the settings that trade one for another.
Example dashboard: the thresholds are starting points I would tune per system, and the colors are made up for the picture.
| Signal | Why I watch it | Where it comes from |
|---|---|---|
| Recall | An approximate index can miss neighbors. Compare it with an exact search on a sample. | a nightly check you run |
| Query latency p99 | Search is what users wait on. | pg_stat_statements |
| Index size vs memory | An HNSW index that does not fit in memory gets much slower. | pg_relation_size |
| Embedding model version | Vectors from two models cannot be compared. | a column you store |
| Index build time | It sets how long a rebuild or a new replica takes. | your build logs |
| Setting | Default | What it trades |
|---|---|---|
| Distance operator | <=> cosine · <-> L2 · <#> inner product | Must match the operator class the index was built with (vector_cosine_ops and so on), or the index is not used. |
| m, ef_construction | 16, 64 | More links and more effort at build time: better recall, a bigger index, a slower build. |
| hnsw.ef_search | 40 | Recall at 10: 0.80 at ef_search 10, 0.95 at 40, 1.00 at 160, all around a millisecond; 2.6 ms at 400. |
| hnsw.iterative_scan | off | relaxed_order or strict_order keep scanning until enough rows pass the filter (0.8 and later). In Notebook 8: 10 of 10 rows, about 9 ms. |
| maintenance_work_mem | 64 MB | The build is much faster when the graph fits in it. Notebook 8 used 1 GB and built 100,000 vectors in 10.5 s. |
-- how big is the index, and is it used?
SELECT pg_size_pretty(pg_relation_size('items_embedding_idx'));
EXPLAIN (ANALYZE, BUFFERS)
SELECT id FROM items ORDER BY embedding <=> $1 LIMIT 10;
-- trade recall for speed, for this session
SET hnsw.ef_search = 100;
-- a filtered search that keeps going until enough rows pass (0.8 and later)
SET hnsw.iterative_scan = relaxed_order;
-- the exact answer, to measure recall against
SET enable_indexscan = off;
Versions and licences. pgvector 0.8 added iterative index scans; 0.8.2 (February 2026) fixed a security bug in parallel HNSW builds (CVE-2026-3172), so upgrade older 0.8 installs. Redis 8 added a vector set type, Cassandra 5.0 added vector search through its storage-attached indexes, and MongoDB offers vector search in Atlas. The vectors on this page were generated, not real embeddings: treat the recall numbers as the shape of the curve.
How do databases actually work? From one row on disk to transactions: the words you need, PostgreSQL, MySQL and MongoDB from the files up, then Redis, Cassandra and vector search, side by side, and the query and concurrency traps.