0Pricing
Vector Databases: Pinecone, Weaviate & pgvector · Lesson

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

  1. What are Vector Databases?
  2. Embeddings: The Core Concept
  3. Similarity Search Explained
  4. Distance Metrics and Indexing Basics
← Back to Vector Databases: Pinecone, Weaviate & pgvector