VEC_DISTANCE_COSINE

You are viewing an old version of this article. View the current version here.
MariaDB starting with 11.6

Vectors were introduced in MariaDB 11.6 Vector Preview.

Syntax

VEC_DISTANCE_COSINE(v, s)

Description

VEC_Distance_Cosine is an SQL function that calculates a Cosine distance between two vectors.

Example

select vec_distance_cosine(vec_fromtext('[1,2,3]'), vec_fromtext('[3,5,7]'));
+-----------------------------------------------------------------------+
| vec_distance_cosine(vec_fromtext('[1,2,3]'), vec_fromtext('[3,5,7]')) |
+-----------------------------------------------------------------------+
|                                                   0.00258509695694209 |
+-----------------------------------------------------------------------+

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.