Skip to main content

Menu

Webinar

Built for the Agentic Era: Introducing MariaDB Enterprise Platform 2027

Register now

White paper

A Practical Guide to AI and Vector Search in Relational Databases

01Executive Summary

02Understanding Vector Search in AI

Fill in the form to read the rest

03Core Database Considerations for Vector Search

E-commerce

Show me ten jackets like this, under $200, that are in stock.


					SELECT  product_id, name, priceFROM    productsWHERE   category = 'Jackets'  AND   price    < 200  AND   in_stock = TRUEORDER BY VEC_DISTANCE(embedding, ?)   -- bind query vector hereLIMIT   10;				

Customer Support

Find recent tickets like this one from premium customers.


					SELECT  ticket_id, subject, opened_atFROM    support_ticketsWHERE   customer_tier = 'Premium'  AND   opened_at >= CURRENT_DATE - INTERVAL 30 DAYORDER BY VEC_DISTANCE(ticket_embedding, ?)   -- bind new-ticket vectorLIMIT   5;				
					SELECT  product_id, name, priceFROM    productsWHERE   category = 'Jackets'  AND   price    < 200  AND   in_stock = TRUEORDER BY VEC_DISTANCE(embedding, ?)   -- bind query vector hereLIMIT   10;				

Documentation


					SELECT  doc_id, title, published_atFROM    kb_articlesWHERE   product       = 'MariaDB Enterprise Platform'  AND   published_at >= CURRENT_DATE - INTERVAL 6 MONTHORDER BY VEC_DISTANCE(article_embedding, ?)   -- bind paragraph vectorLIMIT   15;				
					SELECT  product_id, name, priceFROM    productsWHERE   category = 'Jackets'  AND   price    < 200  AND   in_stock = TRUEORDER BY VEC_DISTANCE(embedding, ?)   -- bind query vector hereLIMIT   10;				

Media Streaming

Find ten action movies like this one, rated PG-13, released after 2015.


					SELECT  movie_id, title, release_yearFROM    moviesWHERE   genre        = 'Action'  AND   rating       = 'PG-13'  AND   release_year >= 2015ORDER BY VEC_DISTANCE(movie_embedding, ?)   -- bind seed-movie vectorLIMIT   10;				
					SELECT  product_id, name, priceFROM    productsWHERE   category = 'Jackets'  AND   price    < 200  AND   in_stock = TRUEORDER BY VEC_DISTANCE(embedding, ?)   -- bind query vector hereLIMIT   10;				

Talent Search

Show candidates whose résumés resemble this profile, located in the United States, with ≥ 5 years’ experience.


					SELECT  candidate_id, full_name, years_experience, last_activeFROM    resumesWHERE   VEC_DISTANCE(resume_embedding, ?) < 0.35   -- strict similarity cut-off  AND   country_code          = 'US'  AND   years_experience     >= 5ORDER BY last_active DESC                         -- secondary sortLIMIT   12;				
					SELECT  product_id, name, priceFROM    productsWHERE   category = 'Jackets'  AND   price    < 200  AND   in_stock = TRUEORDER BY VEC_DISTANCE(embedding, ?)   -- bind query vector hereLIMIT   10;				

04Use Cases Where General-Purpose Databases with Vector Search Excel

05When Might You Use a Specialty Database

06Implementing Vector Search in SQL Databases

Example

Inserting an embedding into a table


					INSERT INTO knowledge_base (id, content, embedding)VALUES (101, 'How to enable SSO', VEC_FROM_TEXT('[0.13, 0.48, 0.91, ...]'));				

Example

Querying for similarity


					SELECT id, contentFROM knowledge_baseORDER BY VEC_DISTANCE(embedding, VEC_FROM_TEXT('[0.12, 0.49, 0.90, ...]'))LIMIT 3;				

Example

Retrieve support tickets similar to a given issue, filtered by product version and priority:


					SELECT id, titleFROM support_ticketsWHERE product_version = '2.1'  AND priority = 'High'ORDER BY VEC_DISTANCE(embedding, VEC_FROM_TEXT('[...]'))LIMIT 5;				

07Conclusion and Strategic Recommendations

08MariaDB Enterprise Platform: A Comprehensive Solution for Modern Data Demands

09The Cloud Database Platform Built for GenAI

10About MariaDB