Skip to main content

l2_distance

Function l2_distance 

Source
pub fn l2_distance<const N: usize, L, R>(
    left: impl IntoExpr<L>,
    right: impl IntoExpr<R>,
) -> Expr<f32>
where L: VectorExpr<N>, R: VectorExpr<N>,
Expand description

Euclidean (L2) distance using pgvector’s <-> operator.

Lower is more similar.

ANN note:

  • This form is operator-based and can use pgvector ivfflat/hnsw indexes for ORDER BY ... LIMIT nearest-neighbor queries.