Home›Learn›Vector databases 4: running it as a DBRE
Vector databases · Chapter 4

Running vector search as a DBRE

What do I look at first?

Recall, latency, memory, and the settings that trade one for another.

Chapter 4 · Running it

What I watch on Vector databases

Recallvs exact searchwatch the trend
Latencyp99 searchwithin target
Index vs RAMfits in memoryalert near the limit
Modelone version per columnno mixing

Example dashboard: the thresholds are starting points I would tune per system, and the colors are made up for the picture.

SignalWhy I watch itWhere it comes from
RecallAn approximate index can miss neighbors. Compare it with an exact search on a sample.a nightly check you run
Query latency p99Search is what users wait on.pg_stat_statements
Index size vs memoryAn HNSW index that does not fit in memory gets much slower.pg_relation_size
Embedding model versionVectors from two models cannot be compared.a column you store
Index build timeIt sets how long a rebuild or a new replica takes.your build logs
The settings that matter

pgvector's settings, with what they did in Notebook 8

SettingDefaultWhat it trades
Distance operator<=> cosine · <-> L2 · <#> inner productMust match the operator class the index was built with (vector_cosine_ops and so on), or the index is not used.
m, ef_construction16, 64More links and more effort at build time: better recall, a bigger index, a slower build.
hnsw.ef_search40Recall 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_scanoffrelaxed_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_mem64 MBThe build is much faster when the graph fits in it. Notebook 8 used 1 GB and built 100,000 vectors in 10.5 s.
Check it yourself

The commands I run first

-- 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;
Measured on this site

Notebook 8, PostgreSQL 18.7 with pgvector 0.8.7, 100,000 generated 384-dimension vectors

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.

Next · chapter 5When it breaksPlaybooks, from the symptom to the fix← Chapter 3: High availability
Part 1 of 4 · Learn · 56 pagesAll pages

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.

Start 1: the basicsStart 2: ten conceptsStart 3: how a query travelsStart 4: napkin mathThe courseShort videosPostgreSQL 1: why PostgreSQLPostgreSQL 2: how it stores your dataPostgreSQL 3: what happens on every writePostgreSQL 4: high availability with PatroniPostgreSQL 5: running it as a DBREPostgreSQL 6: when it breaksPostgreSQL on Kubernetes: CloudNativePGMySQL 1: why MySQLMySQL 2: how it stores your dataMySQL 3: what happens on every writeMySQL 4: high availability with InnoDB ClusterMySQL 5: running it as a DBREMySQL 6: when it breaksMySQL failover with OrchestratorMySQL on Kubernetes: the Percona operatorsMongoDB 1: why MongoDBMongoDB 2: how it stores your dataMongoDB 3: what happens on every writeMongoDB 4: high availability with replica setsMongoDB 5: running it as a DBREMongoDB 6: when it breaksMongoDB on Kubernetes: the Percona operatorB-tree and LSM treeRedis 1: why RedisRedis 2: how it stores your dataRedis 3: high availabilityRedis 4: running it as a DBRERedis 5: when it breaksCassandra 1: why CassandraCassandra 2: how it stores your dataCassandra 3: high availabilityCassandra 4: running it as a DBRECassandra 5: when it breaksVector databases 1: why vector searchVector databases 2: how it stores your dataVector databases 3: high availabilityVector databases 4: running it as a DBREVector databases 5: when it breaksDatabase familiesEngines side by sideQueries that look fine and are notLost updates and write skewMany servers 1: keep a copy runningMany servers 2: who is the leaderMany servers 3: CAP as settingsMany servers 4: unique IDsMany servers 5: split the dataMany servers 6: across servicesMany servers 7: a thousand databasesStaff path, zero to architect