ld.← ALL FIELD NOTESTHE RELATED CASE STUDY ↗
FIELD NOTES / 12INDEXING   ·   THE QDRANT SERIES

How HNSW searches without checking everything.

A full scan compares a query with every vector. HNSW uses a layered graph to find good candidates without normally doing all that work.

Highways and local streets

Hierarchical Navigable Small World builds a graph of nearby vectors across layers. A search starts in a sparse upper layer, navigates toward promising neighbors, and descends to denser layers for a more detailed search.

It is approximate: the speedup comes with a possibility of missing the exact nearest neighbors. Depending on the query and collection, Qdrant can also choose a full scan rather than HNSW.

A LAYERED SEARCH
UPPER LAYERSNavigate broadly
LOWER LAYERSExplore nearby candidates
RESULTApproximate neighbors

Build-time and query-time choices

The m parameter influences graph connectivity; ef_construct controls the candidate search during construction. Larger values can improve search quality but increase index size or build cost. Changing graph settings requires rebuilding the affected index.

At query time, hnsw_ef controls the search candidate list and can be tuned without rebuilding. We started with m = 16 and ef_construct = 100, and treated changes as experiments to benchmark against our data.

Continue the conversation

Further reading

KEEP READING / 11Where do vectors live at runtime?

Another note from the notebook.