This MariaDB tutorial will walk you through one of the upcoming MariaDB features - the MariaDB vector search capability.
The MariaDB vector search feature is now in preview mode.
Users of MariaDB Server can now facilitate search through vector embeddings by making use of functions called VEC_DISTANCE and VEC_FromText.
SQL queries making use of vector embeddings would look like so:
SELECT p.name, p.description
FROM products AS p
ORDER BY VEC_DISTANCE(p.embedding, VEC_FromText('[0.3, 0,5, 0.1, 0.3]')
LIMIT 10;
If used together with the SQL query LIMIT clause, the two functions would make use of the vector index residing in MariaDB.
In MariaDB, a vector index (in this case, the SQL index is called "embedding") can be defined like so:
CREATE TABLE `products` (
`title` varchar(128),
`description` varchar(2000),
VECTOR INDEX (`embedding`)
ENGINE=InnoDB
);
Do note that a SQL embedded index is not a storage engine, but rather, it is a feature within MariaDB that can be used in conjunction with other features.
A full-length video on vector similarity search in MariaDB is available on this channel.
Hopefully this MariaDB tutorial has been useful to you for now, enjoy using MariaDB Server, and make sure to see more similar videos like mariadb vs mysql, sql interview questions and answers videos, and the like, and until next time.
Music:
Insane - Mehul Choudhary: / mehulchoudhary
Creative Commons — Attribution 3.0 Unported — CC BY 3.0
Free Download / Stream: https://bit.ly/3ylmhTm
Music promoted by Audio Library https://bit.ly/3yBgokX
#shorts #reels #database #mysql #mariadb #sql