liveBook · Manning

Recall

As explained in Just Use Postgres!

Recall is the proportion of relevant items that a search system retrieves from all relevant items available.

Recall measures how many retrieved nearest embeddings are the true nearest neighbors. A score of 1 represents perfect recall. section 8.5

Approximate nearest neighbor indexes compare a query with only part of the dataset, trading potential accuracy for faster similarity search. An exact full-table scan should achieve recall of 1. section 8.5

Use recall to assess and tune vector indexes:

  • Compare approximate results with exact nearest-neighbor results to judge how many true matches the index retrieves. section 8.5
  • Increase HNSW m to create a denser graph, which can improve recall and speed lookups while increasing build time and memory use. section 8.5.2
  • Increase ef_construction to consider more close candidates during index construction, producing a better index at the cost of longer builds. section 8.5.2

Movie similarity search

A full scan compares “May the force be with you” against every movie embedding and provides the recall baseline. An HNSW query returns three movies in about 1.97 milliseconds, including Star Wars: Episode VI - Return of the Jedi; increasing ef_search produces a more accurate result set that also includes Star Wars: Episode V - The Empire Strikes Back.

How Just Use Postgres! covers it

How deep it goes
Defines recall, establishes exact-search behavior, and connects HNSW parameters to accuracy and resource trade-offs.
Examples
Uses movie-embedding searches, a full-table scan baseline, HNSW execution plans, and ef_search-adjusted result lists.
What it assumes
Assumes familiarity with embeddings, nearest-neighbor search, vector indexes, and PostgreSQL similarity queries.
What you can do after
Evaluate vector-index accuracy and tune HNSW construction or search parameters to improve retrieved results.
How it connects
Connects approximate nearest-neighbor search, exact nearest-neighbor search, embeddings, IVFFlat, HNSW, and vector similarity search.

Also explained in

Compare how 24 books explain recall →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Just Use Postgres!. The section links point to the parts of the book it draws on.