SlideShare a Scribd company logo
Boosting MySQL with Vector Search
Fosdem 2025
Introducing the MyVector Plugin
Alkin Tezuysal / Shankar Iyer
Let’s get connected!
Alkin Tezuysal - Director of Services @AltinityDB
● Linkedin : https://www.linkedin.com/in/askdba/
Open Source Database Evangelist
● Previously ChistaDATA, PlanetScale, Percona and
Pythian as Senior Technical Manager, SRE, DBA
● Earlier in life Enterprise DBA , Informix, Oracle, DB2 ,
SQL Server
● Recent Recognitions:
○ Most Influential in Database Community
2022 - The Redgate 100
○ MySQL Cookbook, 4th Edition 2022 -
O'Reilly Media, Inc.
○ MySQL Rockstar 2023 - Oracle (MySQL
Community)
○ Database Design and Modeling with
PostgreSQL and MySQL 2024 - <Packt>
@ask_dba
@2025 Altinity, Inc.
Born to Sail, Forced to Work!
Sailing Trivia
1 nautical mile (nm)
equals to …
Let’s get connected!
Shankar Iyer
● Linkedin :
https://www.linkedin.com/in/shankar-iyer-a4a1
563/
● Earlier in life : Engineer in Oracle RAC Database
Development Team (link)
● Recently worked in AWS Aurora MySQL, Google
Cloud MySQL, Clickhouse
● Interests : MySQL for GenAI, Research &
Experimentations in MySQL
performance/replication/availability, SQL
optimizations for BI
-
Vectors and
Dimensions
● Mathematical objects representing magnitude
and direction (velocity, force)
● Vectors can be represented as arrays or ordered
lists of numbers
○ 2D (x, y), 3D (x, y, z), n-dimensional (AI)
● Basically data points
● When dimensions increase data points increase
and they turn into embeddings
@2025 Altinity, Inc.
Understanding Vector
Embeddings
● Vector Embeddings: Mathematical
representations of data in a
high-dimensional space.
● Capture semantic meaning and
relationships between words, phrases, or
other data.
● Enable more accurate and relevant search
results compared to traditional keyword
search.
● Power AI applications like semantic
search, recommendation systems, and
chatbots.
● Data analysis and application
functionality
@2025 Altinity, Inc.
Vector Embeddings
Transforming data into vectors in a way that
captures the semantic meaning or relationships
between the data points. (The image on the left
shows a OpenAI vector embedding for a
Wikipedia article using text-embedding-ada-002
Vector dimension is 1536)
@2025 Altinity, Inc.
OpenAI has another model text-embedding-3-large model provides
3,072-dimensional vector embeddings. P.S: Deep Seek can
generate embedding dimensions upto 8K!
Benefits of Vector
Search
● Efficient and relevant search results.
● Improved relevance for text and image search.
● Semantic understanding.
● Supports AI-based applications.
● Leverage and unlock value from live and
historical business data in the MySQL database :
e.g conversation logs, clinical records, support
tickets, persona descriptions, medical images,
product catalog, legal filings etc.
@2025 Altinity, Inc.
Vector Support Helps
● Traditional search struggles with
high-dimensional data and semantic
understanding.
● Inefficient for AI and ML applications that rely on
vector embeddings.
● Vector support enhances performance and
relevance for similarity searches.
● Enables new AI-driven applications directly within
MySQL.
● Unlocks advanced data analysis techniques
using vector embeddings.
@2025 Altinity, Inc.
Why Vector Search in MySQL?
● MySQL World’s number one open-source relational
database
● Vector search allows for more efficient and relevant search
results.
● Improved relevance for text and image search with
semantic understanding.
● MyVector plugin extends MySQL with vector search
capabilities.
● Supports a wide range of AI-based applications.
P.S: MySQL does not come with extensibility interfaces to
add new data types, and no support to add new index
types and to add new access methods
@2025 Altinity, Inc.
Vector Search Use Cases
Use Cases:
Natural Language Processing (NLP): Words or sentences
are converted into vectors where similar words or phrases
are closer in vector space.
Recommender Systems: Items or users can be embedded
to find similarities or predict preferences.
Image Recognition: Images can be encoded into vectors
for tasks like similarity search or classification.
@2025 Altinity, Inc.
Vector Databases
Vector Database
Providers
● Pinecone
● Qdrant
● Milvus
● Weavite
● Chroma
Vector Store Providers
● ClickHouse
● Elasticsearch
● Singlestore
● Typesense
● Others
○ MySQL
○ MariaDB
○ PostgreSQL.
@2025 Altinity, Inc.
Vector Databases vs Traditional Databases
@2025 Altinity, Inc.
MySQL Vector Plugin Architecture
The MyVector Plugin, discussed earlier,
leverages this architecture. Here's how it
fits:
● UDFs in the plugin: Adds vector-related
SQL functions.
● Data storage : Use varbinary in MySQL 8.x
and VECTOR in MySQL 9.x.
● Indexing: Integrates vector similarity
search via HNSW indexing.
● Similarity Search - Intuitive syntax for
search using SQL
● Administration - Simple MySQL stored
procedures
@2025 Altinity, Inc.
MySQL Vector Plugin Build
/// get the MyVector sources
$ cd mysql-server/src/plugin
$ git clone https://github.com/p3io/myvector-dev/
./myvector
/// Generate makefile for the new plugin
$ cd mysql-server/bld
$ cmake .. <other options used for this build >
/// Build the plugin
$ cd mysql-server/bld/plugin/myvector
$ make @2025 Altinity, Inc.
MySQL Vector Plugin Install
/// Copy the MyVector plugin shared library to the
MySQL installation plugins
$ cp
mysql-server/bld/plugin_output_directory/myvector.so
/usr/local/mysql/lib/plugin/
/// Register the MyVector plugin and create MyVector
stored procedures.
$ cd mysql-server/plugin/myvector
/// Connect to 'mysql' database as 'root'
$ mysql -u root -p mysql
mysql> source myvectorplugin.sql
@2025 Altinity, Inc.
MySQL Vector Plugin Architecture
● MySQL V8.X - InnoDB + Plugin + Varbinary Data Type
● MySQL V9.X - InnoDB + Plugin + Vector Data Type
mysql> select udf_name from
performance_schema.user_defined_functions where udf_name like
"myvector%" ;
+-----------------------------+
| udf_name |
+-----------------------------+
| |
| myvector_is_valid |
| myvector_distance |
| myvector_display |
| myvector_ann_set |
| myvector_row_distance |
| myvector_construct |
+-----------------------------+
@2025 Altinity, Inc.
MyVector Features
High speed, parallel build of HNSW index
Specify recall v/s latency parameters : M, ef,
ef_search
HNSW index is incrementally persisted after initial
build
Online update of index via binlog read & parse of
DMLs
HNSW Index is crash-safe and is recovered on
MySQL instance crash
Write amplification to redo log/undo log avoided
@2025 Altinity, Inc.
MySQL Vector Plugin Examples MySQL 8.X
Ref: https://nlp.stanford.edu/projects/glove/
@2025 Altinity, Inc.
mysql > create table words50d(
wordid int primary key,
word varchar(200),
wordvec MYVECTOR(type=HNSW,
dim=50,size=400000,
M=64,ef=100)
);
– Load the Data (insert …)
mysql> call
myvector_index_build
('test.words50d.wordvec','wordid');
MySQL Vector Plugin Examples MySQL 9.1
mysql > create table words50d(
wordid int primary key,
word varchar(200),
wordvec MYVECTOR(type=HNSW,
dim=50,size=400000,
M=64,ef=100)
);
– Load the Data (insert …)
mysql> call
myvector_index_build
('test.words50d.wordvec','wordid');
@2025 Altinity, Inc.
MySQL Vector Plugin Examples
myvector_construct(vector_string VARCHAR):
Purpose: Converts a human-readable vector string into a serialized binary
format suitable for storage in a VARBINARY / VECTOR column.
Usage Example:
INSERT INTO vectors_table (vector_column)
VALUES (myvector_construct('[0.1, 0.2, 0.3, ...]'));
@2025 Altinity, Inc.
MySQL Vector Plugin Examples
myvector_display(vector_col_expr VARBINARY/VECTOR):
Purpose: Transforms a binary-stored vector back into a
human-readable string representation.
Usage Example:
SELECT myvector_display(vector_column) AS readable_vector
FROM vectors_table;
@2025 Altinity, Inc.
MySQL Vector Plugin Examples
myvector_distance(vec1 VARBINARY/VECTOR, vec2 VARBINARY/VECTOR, disttype VARCHAR):
Purpose: Calculates the distance between two vectors using the specified distance metric ('L2', 'EUCLIDEAN',
or 'IP' for inner product).
Usage Example:
mysql> select myvector_distance((select wordvec from words50d where word = 'school'),
(select wordvec from words50d where word='institute'))G
*************************** 1. row ***************************
myvector_distance((select wordvec from words50d where word = 'school'), (select wordvec
from words50d where word='institute')): 25.51254653930664
1 row in set (0.36 sec)
@2025 Altinity, Inc.
MySQL Vector Plugin Examples
Similarity Search (ANN)
SELECT <column-list> FROM <table> WHERE
MYVECTOR_IS_ANN('vector_column','key column',
<search vector>, options)
// search vector(s) should first be inserted to <query_table>
SELECT <column-list> FROM
MYVECTOR_SEARCH[<base_table>, <key column>,
<vector_column>, <query_table>]
@2025 Altinity, Inc.
MySQL Vector Plugin Examples
myvector_ann_set(veccol VARCHAR, options VARCHAR, searchvec VECTOR/VARBINARY):
Purpose: Returns a comma-separated list of IDs corresponding to the nearest neighbors of a given search
vector.
Usage Example:
SELECT myvector_ann_set('vector_column', 'options', myvector_construct('[0.1, 0.2, 0.3,
...]')) AS neighbors FROM vectors_table;
@2025 Altinity, Inc.
MySQL Vector Plugin Examples
Vector Index Administration - Stored Procedures
// build the index
CALL myvector_index_build('vector column', 'key column')
// check current status of the index - number of rows, parameters etc
CALL myvector_index_status('vector column')
// open/load the index into memory after a restart (if not marked online)
CALL myvector_index_load('vector column')
// drop the the index
CALL myvector_index_drop('vector column')
@2025 Altinity, Inc.
Demo
https://github.com/p3io/myvector-dev/tree/main/demo
@2025 Altinity, Inc.
References
https://medium.com/@shiyer22/introducing-myvector-plugin-vector-storage-similarity-search-in-mysql-a32a6f84755e
https://medium.com/@shiyer22/introducing-myvector-plugin-vector-storage-similarity-search-in-mysql-part-2-74a7195226e2
https://medium.com/@shiyer22/myvector-plugin-part-3-nearest-neighbour-search-with-other-predicates-and-the-sql-optimizer-7541bf
aa3df9
https://blogs.oracle.com/mysql/post/mysql-vector-datatype-create-your-operations-part-1
https://lefred.be/content/mysql-vector-datatype-create-your-operations-part-2/
https://learning.oreilly.com/home/#:~:text=Vector%20Databases%20Deep%20Dive
https://asciinema.org/a/KZeSifbD0QpHYmYUep5SiaCMA
https://asciinema.org/a/YTIg12ClZAh38qUcgsBUAdSA7
https://asciinema.org/a/4uro9wYgFijuwP3EdJvp0tRMj
https://asciinema.org/a/O7rNs2OzLXyUja0bwWcldXsX9
https://asciinema.org/a/RJs3CFbuShQGeXkCSxDDG0n3i
@2025 Altinity, Inc.

More Related Content

Similar to Boosting MySQL with Vector Search Fosdem 2025.pdf (20)

PDF
Beyond Retrieval Augmented Generation (RAG): Vector Databases
Zilliz
 
PPTX
Vector_Databases_Detailed_Presentation.pptx
TathagataDe2
 
PPTX
Vector_Databases_Presentation_in_modern_era.pptx
TathagataDe2
 
PDF
A14 Getting Started with Vectorwise by Mark Van de Wiel
Insight Technology, Inc.
 
PDF
Red Hat Summit Connect 2023 - Redis Enterprise, the engine of Generative AI
Luigi Fugaro
 
PDF
How Vector Search Transforms Information Retrieval?
Lucy Zeniffer
 
PDF
Distributed Vector Databases - What, Why, and How
DoKC
 
PDF
Vector Databases 101 - An introduction to the world of Vector Databases
Zilliz
 
PDF
Maximizing AI Performance with Vector Databases: A Comprehensive Guide
Bhusan Chettri
 
PDF
Vectorwise database training
Zahid Quadri
 
PDF
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
PDF
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
Luigi Fugaro
 
PDF
06-20-2024-AI Camp Meetup-Unstructured Data and Vector Databases
Timothy Spann
 
PPTX
Vector-Database-Deep-Dive into the new technology.pptx
Dhruvkashyap38
 
PPTX
RAG Patterns and Vector Search in Generative AI
Udaiappa Ramachandran
 
PPTX
RheoData_23ai_Vector-Datatype-Webinar-2024.pptx
Bobby Curtis
 
PDF
Vector databases and neural search
Dmitry Kan
 
PDF
London IR Meetup - Players in Vector Search_ algorithms, software and use cases
Dmitry Kan
 
PDF
09-26-2024 Conf 42 Kube Native: Unleashing the Potential of Cloud Native Open...
Timothy Spann
 
PDF
Elevating PostgreSQL: Benchmarking Vector Search Performance
ScyllaDB
 
Beyond Retrieval Augmented Generation (RAG): Vector Databases
Zilliz
 
Vector_Databases_Detailed_Presentation.pptx
TathagataDe2
 
Vector_Databases_Presentation_in_modern_era.pptx
TathagataDe2
 
A14 Getting Started with Vectorwise by Mark Van de Wiel
Insight Technology, Inc.
 
Red Hat Summit Connect 2023 - Redis Enterprise, the engine of Generative AI
Luigi Fugaro
 
How Vector Search Transforms Information Retrieval?
Lucy Zeniffer
 
Distributed Vector Databases - What, Why, and How
DoKC
 
Vector Databases 101 - An introduction to the world of Vector Databases
Zilliz
 
Maximizing AI Performance with Vector Databases: A Comprehensive Guide
Bhusan Chettri
 
Vectorwise database training
Zahid Quadri
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
Luigi Fugaro
 
06-20-2024-AI Camp Meetup-Unstructured Data and Vector Databases
Timothy Spann
 
Vector-Database-Deep-Dive into the new technology.pptx
Dhruvkashyap38
 
RAG Patterns and Vector Search in Generative AI
Udaiappa Ramachandran
 
RheoData_23ai_Vector-Datatype-Webinar-2024.pptx
Bobby Curtis
 
Vector databases and neural search
Dmitry Kan
 
London IR Meetup - Players in Vector Search_ algorithms, software and use cases
Dmitry Kan
 
09-26-2024 Conf 42 Kube Native: Unleashing the Potential of Cloud Native Open...
Timothy Spann
 
Elevating PostgreSQL: Benchmarking Vector Search Performance
ScyllaDB
 

More from Alkin Tezuysal (20)

PDF
Unified Observability - Alkin Tezuysal - FOSSASIA Summit March 2025 .pdf
Alkin Tezuysal
 
PDF
London MySQL Day - Lightning Talk Dec 2024.pdf
Alkin Tezuysal
 
PDF
Design and Modeling with MySQL and PostgreSQL - Percona University Istanbul S...
Alkin Tezuysal
 
PDF
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Alkin Tezuysal
 
PPTX
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Alkin Tezuysal
 
PDF
FOSSASIA - MySQL Cookbook 4e Journey APR 2023.pdf
Alkin Tezuysal
 
PDF
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
Alkin Tezuysal
 
PDF
How OLTP to OLAP Archival Demystified
Alkin Tezuysal
 
PDF
MySQL Cookbook: Recipes for Developers, Alkin Tezuysal and Sveta Smirnova - P...
Alkin Tezuysal
 
PDF
My first 90 days with ClickHouse.pdf
Alkin Tezuysal
 
PDF
KubeCon_NA_2021
Alkin Tezuysal
 
PDF
Integrating best of breed open source tools to vitess orchestrator pleu21
Alkin Tezuysal
 
PDF
Vitess: Scalable Database Architecture - Kubernetes Community Days Africa Ap...
Alkin Tezuysal
 
PDF
How to shard MariaDB like a pro - FOSDEM 2021
Alkin Tezuysal
 
PDF
Vitess - Data on Kubernetes
Alkin Tezuysal
 
PDF
MySQL Ecosystem in 2020
Alkin Tezuysal
 
PDF
Introduction to Vitess on Kubernetes for MySQL - Webinar
Alkin Tezuysal
 
PDF
When is Myrocks good? 2020 Webinar Series
Alkin Tezuysal
 
PPTX
Mysql 8 vs Mariadb 10.4 Webinar 2020 Feb
Alkin Tezuysal
 
PPTX
Myrocks in the wild wild west! FOSDEM 2020
Alkin Tezuysal
 
Unified Observability - Alkin Tezuysal - FOSSASIA Summit March 2025 .pdf
Alkin Tezuysal
 
London MySQL Day - Lightning Talk Dec 2024.pdf
Alkin Tezuysal
 
Design and Modeling with MySQL and PostgreSQL - Percona University Istanbul S...
Alkin Tezuysal
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Alkin Tezuysal
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Alkin Tezuysal
 
FOSSASIA - MySQL Cookbook 4e Journey APR 2023.pdf
Alkin Tezuysal
 
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
Alkin Tezuysal
 
How OLTP to OLAP Archival Demystified
Alkin Tezuysal
 
MySQL Cookbook: Recipes for Developers, Alkin Tezuysal and Sveta Smirnova - P...
Alkin Tezuysal
 
My first 90 days with ClickHouse.pdf
Alkin Tezuysal
 
KubeCon_NA_2021
Alkin Tezuysal
 
Integrating best of breed open source tools to vitess orchestrator pleu21
Alkin Tezuysal
 
Vitess: Scalable Database Architecture - Kubernetes Community Days Africa Ap...
Alkin Tezuysal
 
How to shard MariaDB like a pro - FOSDEM 2021
Alkin Tezuysal
 
Vitess - Data on Kubernetes
Alkin Tezuysal
 
MySQL Ecosystem in 2020
Alkin Tezuysal
 
Introduction to Vitess on Kubernetes for MySQL - Webinar
Alkin Tezuysal
 
When is Myrocks good? 2020 Webinar Series
Alkin Tezuysal
 
Mysql 8 vs Mariadb 10.4 Webinar 2020 Feb
Alkin Tezuysal
 
Myrocks in the wild wild west! FOSDEM 2020
Alkin Tezuysal
 
Ad

Recently uploaded (20)

PPTX
apidays Helsinki & North 2025 - API access control strategies beyond JWT bear...
apidays
 
PPTX
Exploring Multilingual Embeddings for Italian Semantic Search: A Pretrained a...
Sease
 
PDF
WEF_Future_of_Global_Fintech_Second_Edition_2025.pdf
AproximacionAlFuturo
 
PDF
Building Production-Ready AI Agents with LangGraph.pdf
Tamanna
 
PDF
Product Management in HealthTech (Case Studies from SnappDoctor)
Hamed Shams
 
PPTX
apidays Munich 2025 - Building an AWS Serverless Application with Terraform, ...
apidays
 
PPTX
b6057ea5-8e8c-4415-90c0-ed8e9666ffcd.pptx
Anees487379
 
PDF
JavaScript - Good or Bad? Tips for Google Tag Manager
📊 Markus Baersch
 
PDF
OPPOTUS - Malaysias on Malaysia 1Q2025.pdf
Oppotus
 
PDF
apidays Helsinki & North 2025 - How (not) to run a Graphql Stewardship Group,...
apidays
 
PPT
Data base management system Transactions.ppt
gandhamcharan2006
 
PDF
Merits and Demerits of DBMS over File System & 3-Tier Architecture in DBMS
MD RIZWAN MOLLA
 
PPTX
apidays Singapore 2025 - From Data to Insights: Building AI-Powered Data APIs...
apidays
 
PDF
Web Scraping with Google Gemini 2.0 .pdf
Tamanna
 
PDF
AUDITABILITY & COMPLIANCE OF AI SYSTEMS IN HEALTHCARE
GAHI Youssef
 
PPTX
AI Presentation Tool Pitch Deck Presentation.pptx
ShyamPanthavoor1
 
PPTX
Module-5-Measures-of-Central-Tendency-Grouped-Data-1.pptx
lacsonjhoma0407
 
PPTX
apidays Helsinki & North 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (A...
apidays
 
PPT
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
PDF
List of all the AI prompt cheat codes.pdf
Avijit Kumar Roy
 
apidays Helsinki & North 2025 - API access control strategies beyond JWT bear...
apidays
 
Exploring Multilingual Embeddings for Italian Semantic Search: A Pretrained a...
Sease
 
WEF_Future_of_Global_Fintech_Second_Edition_2025.pdf
AproximacionAlFuturo
 
Building Production-Ready AI Agents with LangGraph.pdf
Tamanna
 
Product Management in HealthTech (Case Studies from SnappDoctor)
Hamed Shams
 
apidays Munich 2025 - Building an AWS Serverless Application with Terraform, ...
apidays
 
b6057ea5-8e8c-4415-90c0-ed8e9666ffcd.pptx
Anees487379
 
JavaScript - Good or Bad? Tips for Google Tag Manager
📊 Markus Baersch
 
OPPOTUS - Malaysias on Malaysia 1Q2025.pdf
Oppotus
 
apidays Helsinki & North 2025 - How (not) to run a Graphql Stewardship Group,...
apidays
 
Data base management system Transactions.ppt
gandhamcharan2006
 
Merits and Demerits of DBMS over File System & 3-Tier Architecture in DBMS
MD RIZWAN MOLLA
 
apidays Singapore 2025 - From Data to Insights: Building AI-Powered Data APIs...
apidays
 
Web Scraping with Google Gemini 2.0 .pdf
Tamanna
 
AUDITABILITY & COMPLIANCE OF AI SYSTEMS IN HEALTHCARE
GAHI Youssef
 
AI Presentation Tool Pitch Deck Presentation.pptx
ShyamPanthavoor1
 
Module-5-Measures-of-Central-Tendency-Grouped-Data-1.pptx
lacsonjhoma0407
 
apidays Helsinki & North 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (A...
apidays
 
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
List of all the AI prompt cheat codes.pdf
Avijit Kumar Roy
 
Ad

Boosting MySQL with Vector Search Fosdem 2025.pdf

  • 1. Boosting MySQL with Vector Search Fosdem 2025 Introducing the MyVector Plugin Alkin Tezuysal / Shankar Iyer
  • 2. Let’s get connected! Alkin Tezuysal - Director of Services @AltinityDB ● Linkedin : https://www.linkedin.com/in/askdba/ Open Source Database Evangelist ● Previously ChistaDATA, PlanetScale, Percona and Pythian as Senior Technical Manager, SRE, DBA ● Earlier in life Enterprise DBA , Informix, Oracle, DB2 , SQL Server ● Recent Recognitions: ○ Most Influential in Database Community 2022 - The Redgate 100 ○ MySQL Cookbook, 4th Edition 2022 - O'Reilly Media, Inc. ○ MySQL Rockstar 2023 - Oracle (MySQL Community) ○ Database Design and Modeling with PostgreSQL and MySQL 2024 - <Packt> @ask_dba @2025 Altinity, Inc. Born to Sail, Forced to Work!
  • 3. Sailing Trivia 1 nautical mile (nm) equals to …
  • 4. Let’s get connected! Shankar Iyer ● Linkedin : https://www.linkedin.com/in/shankar-iyer-a4a1 563/ ● Earlier in life : Engineer in Oracle RAC Database Development Team (link) ● Recently worked in AWS Aurora MySQL, Google Cloud MySQL, Clickhouse ● Interests : MySQL for GenAI, Research & Experimentations in MySQL performance/replication/availability, SQL optimizations for BI -
  • 5. Vectors and Dimensions ● Mathematical objects representing magnitude and direction (velocity, force) ● Vectors can be represented as arrays or ordered lists of numbers ○ 2D (x, y), 3D (x, y, z), n-dimensional (AI) ● Basically data points ● When dimensions increase data points increase and they turn into embeddings @2025 Altinity, Inc.
  • 6. Understanding Vector Embeddings ● Vector Embeddings: Mathematical representations of data in a high-dimensional space. ● Capture semantic meaning and relationships between words, phrases, or other data. ● Enable more accurate and relevant search results compared to traditional keyword search. ● Power AI applications like semantic search, recommendation systems, and chatbots. ● Data analysis and application functionality @2025 Altinity, Inc.
  • 7. Vector Embeddings Transforming data into vectors in a way that captures the semantic meaning or relationships between the data points. (The image on the left shows a OpenAI vector embedding for a Wikipedia article using text-embedding-ada-002 Vector dimension is 1536) @2025 Altinity, Inc. OpenAI has another model text-embedding-3-large model provides 3,072-dimensional vector embeddings. P.S: Deep Seek can generate embedding dimensions upto 8K!
  • 8. Benefits of Vector Search ● Efficient and relevant search results. ● Improved relevance for text and image search. ● Semantic understanding. ● Supports AI-based applications. ● Leverage and unlock value from live and historical business data in the MySQL database : e.g conversation logs, clinical records, support tickets, persona descriptions, medical images, product catalog, legal filings etc. @2025 Altinity, Inc.
  • 9. Vector Support Helps ● Traditional search struggles with high-dimensional data and semantic understanding. ● Inefficient for AI and ML applications that rely on vector embeddings. ● Vector support enhances performance and relevance for similarity searches. ● Enables new AI-driven applications directly within MySQL. ● Unlocks advanced data analysis techniques using vector embeddings. @2025 Altinity, Inc.
  • 10. Why Vector Search in MySQL? ● MySQL World’s number one open-source relational database ● Vector search allows for more efficient and relevant search results. ● Improved relevance for text and image search with semantic understanding. ● MyVector plugin extends MySQL with vector search capabilities. ● Supports a wide range of AI-based applications. P.S: MySQL does not come with extensibility interfaces to add new data types, and no support to add new index types and to add new access methods @2025 Altinity, Inc.
  • 11. Vector Search Use Cases Use Cases: Natural Language Processing (NLP): Words or sentences are converted into vectors where similar words or phrases are closer in vector space. Recommender Systems: Items or users can be embedded to find similarities or predict preferences. Image Recognition: Images can be encoded into vectors for tasks like similarity search or classification. @2025 Altinity, Inc.
  • 12. Vector Databases Vector Database Providers ● Pinecone ● Qdrant ● Milvus ● Weavite ● Chroma Vector Store Providers ● ClickHouse ● Elasticsearch ● Singlestore ● Typesense ● Others ○ MySQL ○ MariaDB ○ PostgreSQL. @2025 Altinity, Inc.
  • 13. Vector Databases vs Traditional Databases @2025 Altinity, Inc.
  • 14. MySQL Vector Plugin Architecture The MyVector Plugin, discussed earlier, leverages this architecture. Here's how it fits: ● UDFs in the plugin: Adds vector-related SQL functions. ● Data storage : Use varbinary in MySQL 8.x and VECTOR in MySQL 9.x. ● Indexing: Integrates vector similarity search via HNSW indexing. ● Similarity Search - Intuitive syntax for search using SQL ● Administration - Simple MySQL stored procedures @2025 Altinity, Inc.
  • 15. MySQL Vector Plugin Build /// get the MyVector sources $ cd mysql-server/src/plugin $ git clone https://github.com/p3io/myvector-dev/ ./myvector /// Generate makefile for the new plugin $ cd mysql-server/bld $ cmake .. <other options used for this build > /// Build the plugin $ cd mysql-server/bld/plugin/myvector $ make @2025 Altinity, Inc.
  • 16. MySQL Vector Plugin Install /// Copy the MyVector plugin shared library to the MySQL installation plugins $ cp mysql-server/bld/plugin_output_directory/myvector.so /usr/local/mysql/lib/plugin/ /// Register the MyVector plugin and create MyVector stored procedures. $ cd mysql-server/plugin/myvector /// Connect to 'mysql' database as 'root' $ mysql -u root -p mysql mysql> source myvectorplugin.sql @2025 Altinity, Inc.
  • 17. MySQL Vector Plugin Architecture ● MySQL V8.X - InnoDB + Plugin + Varbinary Data Type ● MySQL V9.X - InnoDB + Plugin + Vector Data Type mysql> select udf_name from performance_schema.user_defined_functions where udf_name like "myvector%" ; +-----------------------------+ | udf_name | +-----------------------------+ | | | myvector_is_valid | | myvector_distance | | myvector_display | | myvector_ann_set | | myvector_row_distance | | myvector_construct | +-----------------------------+ @2025 Altinity, Inc.
  • 18. MyVector Features High speed, parallel build of HNSW index Specify recall v/s latency parameters : M, ef, ef_search HNSW index is incrementally persisted after initial build Online update of index via binlog read & parse of DMLs HNSW Index is crash-safe and is recovered on MySQL instance crash Write amplification to redo log/undo log avoided @2025 Altinity, Inc.
  • 19. MySQL Vector Plugin Examples MySQL 8.X Ref: https://nlp.stanford.edu/projects/glove/ @2025 Altinity, Inc. mysql > create table words50d( wordid int primary key, word varchar(200), wordvec MYVECTOR(type=HNSW, dim=50,size=400000, M=64,ef=100) ); – Load the Data (insert …) mysql> call myvector_index_build ('test.words50d.wordvec','wordid');
  • 20. MySQL Vector Plugin Examples MySQL 9.1 mysql > create table words50d( wordid int primary key, word varchar(200), wordvec MYVECTOR(type=HNSW, dim=50,size=400000, M=64,ef=100) ); – Load the Data (insert …) mysql> call myvector_index_build ('test.words50d.wordvec','wordid'); @2025 Altinity, Inc.
  • 21. MySQL Vector Plugin Examples myvector_construct(vector_string VARCHAR): Purpose: Converts a human-readable vector string into a serialized binary format suitable for storage in a VARBINARY / VECTOR column. Usage Example: INSERT INTO vectors_table (vector_column) VALUES (myvector_construct('[0.1, 0.2, 0.3, ...]')); @2025 Altinity, Inc.
  • 22. MySQL Vector Plugin Examples myvector_display(vector_col_expr VARBINARY/VECTOR): Purpose: Transforms a binary-stored vector back into a human-readable string representation. Usage Example: SELECT myvector_display(vector_column) AS readable_vector FROM vectors_table; @2025 Altinity, Inc.
  • 23. MySQL Vector Plugin Examples myvector_distance(vec1 VARBINARY/VECTOR, vec2 VARBINARY/VECTOR, disttype VARCHAR): Purpose: Calculates the distance between two vectors using the specified distance metric ('L2', 'EUCLIDEAN', or 'IP' for inner product). Usage Example: mysql> select myvector_distance((select wordvec from words50d where word = 'school'), (select wordvec from words50d where word='institute'))G *************************** 1. row *************************** myvector_distance((select wordvec from words50d where word = 'school'), (select wordvec from words50d where word='institute')): 25.51254653930664 1 row in set (0.36 sec) @2025 Altinity, Inc.
  • 24. MySQL Vector Plugin Examples Similarity Search (ANN) SELECT <column-list> FROM <table> WHERE MYVECTOR_IS_ANN('vector_column','key column', <search vector>, options) // search vector(s) should first be inserted to <query_table> SELECT <column-list> FROM MYVECTOR_SEARCH[<base_table>, <key column>, <vector_column>, <query_table>] @2025 Altinity, Inc.
  • 25. MySQL Vector Plugin Examples myvector_ann_set(veccol VARCHAR, options VARCHAR, searchvec VECTOR/VARBINARY): Purpose: Returns a comma-separated list of IDs corresponding to the nearest neighbors of a given search vector. Usage Example: SELECT myvector_ann_set('vector_column', 'options', myvector_construct('[0.1, 0.2, 0.3, ...]')) AS neighbors FROM vectors_table; @2025 Altinity, Inc.
  • 26. MySQL Vector Plugin Examples Vector Index Administration - Stored Procedures // build the index CALL myvector_index_build('vector column', 'key column') // check current status of the index - number of rows, parameters etc CALL myvector_index_status('vector column') // open/load the index into memory after a restart (if not marked online) CALL myvector_index_load('vector column') // drop the the index CALL myvector_index_drop('vector column') @2025 Altinity, Inc.
  • 28. References https://medium.com/@shiyer22/introducing-myvector-plugin-vector-storage-similarity-search-in-mysql-a32a6f84755e https://medium.com/@shiyer22/introducing-myvector-plugin-vector-storage-similarity-search-in-mysql-part-2-74a7195226e2 https://medium.com/@shiyer22/myvector-plugin-part-3-nearest-neighbour-search-with-other-predicates-and-the-sql-optimizer-7541bf aa3df9 https://blogs.oracle.com/mysql/post/mysql-vector-datatype-create-your-operations-part-1 https://lefred.be/content/mysql-vector-datatype-create-your-operations-part-2/ https://learning.oreilly.com/home/#:~:text=Vector%20Databases%20Deep%20Dive https://asciinema.org/a/KZeSifbD0QpHYmYUep5SiaCMA https://asciinema.org/a/YTIg12ClZAh38qUcgsBUAdSA7 https://asciinema.org/a/4uro9wYgFijuwP3EdJvp0tRMj https://asciinema.org/a/O7rNs2OzLXyUja0bwWcldXsX9 https://asciinema.org/a/RJs3CFbuShQGeXkCSxDDG0n3i @2025 Altinity, Inc.