> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/vector-functions.md).

# Vector Functions

{% columns %}
{% column %}
{% content-ref url="/pages/chnLTCFAfvG9AMshyywR" %}
[VEC\_DISTANCE](/docs/server/reference/sql-functions/vector-functions/vector-functions-vec_distance.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Calculate distance between vectors. This function computes the distance between two vectors using either Euclidean or Cosine metric, depending on the index.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/7lAZ41CAUddc0SjNVXTt" %}
[VEC\_DISTANCE\_COSINE](/docs/server/reference/sql-functions/vector-functions/vec_distance_cosine.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Calculate Cosine distance. This function computes the Cosine distance between two vectors, measuring the cosine of the angle between them.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/G9kIq8lgTXRLdp9neQbM" %}
[VEC\_DISTANCE\_EUCLIDEAN](/docs/server/reference/sql-functions/vector-functions/vec_distance_euclidean.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Calculate Euclidean distance. This function computes the Euclidean (L2) distance between two vectors, representing the straight-line distance.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/2vM4miPacYq8zSu6gXM1" %}
[VEC\_FromText](/docs/server/reference/sql-functions/vector-functions/vec_fromtext.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Convert text to vector. This function parses a JSON array string representation of a vector and converts it into the binary VECTOR data type.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/rBfOOHg1fTf7DkhZRupF" %}
[VEC\_ToText](/docs/server/reference/sql-functions/vector-functions/vec_totext.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Convert vector to text. This function takes a binary VECTOR data type and returns its JSON array string representation.
{% endcolumn %}
{% endcolumns %}
