# DISTANCE() and VECTOR\_DISTANCE(): Vector Similarity in Percona Server for MySQL 9.7

DevFeed: [DISTANCE() and VECTOR\_DISTANCE(): Vector Similarity in Percona Server for MySQL 9.7](<https://devfeed.tech/articles/distance-and-vector-distance-vector-similarity-in-percona-server-for-mysql-9-7-57445.md>)

Original publisher: [Read original article](<https://www.percona.com/blog/vector-distance-vector-similarity-search-in-percona-server-for-mysql/>)

Author: Catalin Besleaga

Published: 2026-09-21T09:57:06Z

Content type: release

Language: en

Sources: [Percona](<https://devfeed.tech/sources/blog-percona.md>)

Topics: [Percona Server for MySQL](<https://devfeed.tech/topics/percona-server-for-mysql.md>), [MySQL](<https://devfeed.tech/topics/mysql.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Embeddings](<https://devfeed.tech/topics/embeddings.md>), [cpu](<https://devfeed.tech/topics/cpu.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [ai-vector](<https://devfeed.tech/tags/ai-vector.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [embeddings](<https://devfeed.tech/tags/embeddings.md>), [hnsw](<https://devfeed.tech/tags/hnsw.md>), [indexing](<https://devfeed.tech/tags/indexing.md>), [mysql](<https://devfeed.tech/tags/mysql.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [openai](<https://devfeed.tech/tags/openai.md>), [percona-server-for-mysql](<https://devfeed.tech/tags/percona-server-for-mysql.md>), [similarity-search](<https://devfeed.tech/tags/similarity-search.md>), [sql](<https://devfeed.tech/tags/sql.md>), [vector](<https://devfeed.tech/tags/vector.md>), [vector-distance](<https://devfeed.tech/tags/vector-distance.md>)

## AI overview

Percona Server for MySQL 9.7.2-2 adds DISTANCE() and VECTOR_DISTANCE() for calculating vector similarity directly in SQL. The release supports cosine, Euclidean, squared Euclidean, Manhattan, and dot-product metrics, with SIMD acceleration and compatibility with VECTOR data and embeddings.

## Source excerpt

TL;DR Percona Server for MySQL 9.7.2-2 now supports DISTANCE() for vector similarity scoring directly in SQL (COSINE, EUCLIDEAN, MANHATTAN, DOT metrics). This is the compute primitive you need to rank or filter embeddings by similarity directly in SQL. ANN indexing (e.g. HNSW, IVF) is the next milestone for fast large-scale similarity search; and this function provides ... Continued The post DISTANCE() and VECTOR_DISTANCE(): Vector Similarity in Percona Server for MySQL 9.7 appeared first on Percona.