---
title: "Vector search"
description: "Given a query vector, find the nearest stored vectors — the k-nearest-neighbor problem. Exact search compares against everything (correct but O(N)); approx"
canonical_url: "https://fanout.sh/ai-engineering/lessons/vector-search"
md_url: "https://fanout.sh/ai-engineering/lessons/vector-search.md"
access: "public"
---

# Vector search

Given a query vector, find the nearest stored vectors — the k-nearest-neighbor problem. Exact search compares against everything (correct but O(N)); approx

## Public overview

Given a query vector, find the nearest stored vectors — the k-nearest-neighbor problem. Exact search compares against everything (correct but O(N)); approximate nearest neighbor (ANN) structures give up a sliver of recall to answer in milliseconds at millions of vectors. This lesson sets up why hashmaps and B-trees are useless here and indexes are their replacement.

---
This representation contains public Fanout content only. Protected Pro lessons, account data, billing, checkout, and pricing are not included.

Browse the public content map: https://fanout.sh/sitemap.md
