Distance Metrics and Indexing Basics
Learn the distance metrics that define vector similarity and the approximate nearest neighbor indexes that make vector search fast at scale.
Measuring Closeness
A vector DB finds vectors close to your query, but 'close' is defined by a distance metric — and the metric you pick shapes what counts as similar.
Euclidean Distance
Euclidean (L2) distance is the straight-line distance between two points: smaller means closer. Run the example to see it.
import math
def l2(a, b):
return math.sqrt(sum((x-y)**2 for x, y in zip(a, b)))
print(round(l2([0,0],[3,4]), 1))All lessons in this course
- What are Vector Databases?
- Embeddings: The Core Concept
- Similarity Search Explained
- Distance Metrics and Indexing Basics