Syntax\n------\n\nVEC_DISTANCE_EUCLIDEAN(v, s)\n\nDescription\n-----------\n\nVEC_Distance_Euclidean is an SQL function that calculates a Euclidean (L2) distance between two points.\n\nVectors must be of the same length, a distance between two vectors of different lengths is not defined and VEC_Distance_Euclidean returns NULL in such cases.\n\nIf the vector index was not built for the euclidean function (see CREATE TABLE with Vectors), the index is not used, and a full table scan performed instead. The VEC_DISTANCE function is a generic function that behaves either as VEC_DISTANCE_EUCLIDEAN or VEC_DISTANCE_COSINE, depending on the underlying index type.\n\nExamples\n--------\n\nINSERT INTO v VALUES \n     (1, x'e360d63ebe554f3fcdbc523f4522193f5236083d'),\n     (2, x'f511303f72224a3fdd05fe3eb22a133ffae86a3f'),\n     (3,x'f09baa3ea172763f123def3e0c7fe53e288bf33e'),\n     (4,x'b97a523f2a193e3eb4f62e3f2d23583e9dd60d3f'),\n     (5,x'f7c5df3e984b2b3e65e59d3d7376db3eac63773e'),\n     (6,x'de01453ffa486d3f10aa4d3fdd66813c71cb163f'),\n     (7,x'76edfc3e4b57243f10f8423fb158713f020bda3e'),\n     (8,x'56926c3fdf098d3e2c8c5e3d1ad4953daa9d0b3e'),\n     (9,x'7b713f3e5258323f80d1113d673b2b3f66e3583f'),\n     (10,x'6ca1d43e9df91b3fe580da3e1c247d3f147cf33e');\n\nSELECT id FROM v \n  ORDER BY VEC_Distance_Euclidean(v, x'6ca1d43e9df91b3fe580da3e1c247d3f147cf33e');\n+----+\n| id |\n+----+\n| 10 |\n|  7 |\n|  3 |\n|  9 |\n|  2 |\n|  1 |\n|  5 |\n|  4 |\n|  6 |\n|  8 |\n+----+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/vector-functions/vec_distance_euclidean