pgvector provides native support for vector similarity search in PostgreSQL. It supports three types of distance metrics, each useful depending on the use case:•
<=> Cosine distance – Measures the angle between two vectors (ignores magnitude). Great for comparing meaning in text (e.g., NLP). Smaller angle = more similar.•
<#> L2 (Euclidean distance) – Measures the straight-line distance between two vectors. Takes both direction and size into account. Good when actual value differences matter (like in image or audio data).•
<-> Inner product – Measures how much two vectors point in the same direction and how large they are. If vectors are normalized (length = 1), it works like cosine similarity. Great for ranking similarity when vectors are preprocessed.#pgvector #PostgreSQL #VectorSearch #Embeddings