- Categories:
VECTOR_L2_DISTANCE¶
Computes the L2 distance between two vectors.
L2 distance, also known as the Euclidean distance, is a measure of the distance between two vectors in a vector space. The distance is calculated by taking the square root of the sum of the squared differences of vector elements. The distance can be a value of zero or higher. If the distance is zero, the vectors are identical. A larger distance indicates that the vectors are farther apart.
Syntax¶
Arguments¶
vectorThe VECTOR value to calculate the distance from.
vectorThe VECTOR value to calculate the distance to.
Returns¶
Returns the distance between the two input vectors as a FLOAT value.
Usage notes¶
Vector functions are optimized in a way that can reduce floating point precision. This function’s results have a margin of error up to
1e-4.
Examples¶
This example uses the VECTOR_L2_DISTANCE function to determine which vectors in the table
are closest to each other between columns a and b: