MariaDB Vector

MariaDB Vector is an extension or feature of MariaDB, providing capabilities for handling and querying vector data within the MariaDB ecosystem.

About this tool

Overview

MariaDB Vector is an extension of MariaDB, guided by the MariaDB Foundation and built with the MariaDB Server community. It enables fast vector search directly within a relational database, simplifying the technology stack by removing the need for specialized datastores. Available in MariaDB since version 11.7 and now in 11.8 GA LTS, it introduces vector similarity search capabilities, including specialized syntax and a new index type for efficient searching of vectors based on distance functions.

Features

  • Dedicated Data Type: Introduces a VECTOR data type for storing vector embeddings.
  • Specialized Indexing: Provides a VECTOR index type, utilizing a modified version of the Hierarchical Navigable Small Worlds (HNSW) algorithm for fast search.
  • Vector Distance Functions: Supports functions like VEC_DISTANCE_EUCLIDEAN and VEC_DISTANCE_COSINE for calculating similarity.
  • Utility Functions: Includes VEC_FromText for converting text representations to vectors and VEC_ToText for converting vector bytes to text.
  • SQL Integration: Seamlessly integrates with SQL for creating tables with vector columns, inserting vector data, and performing vector searches.
  • Optimizer Tuning: The MariaDB optimizer is tuned to leverage the vector index for SELECT queries that include ORDER BY VEC_DISTANC_EUCLIDEAN (or VEC_DISTANC_COSINE) and a LIMIT clause.

Performance

MariaDB Vector's implementation of a modified HNSW algorithm offers search performance comparable to other vector search solutions. It demonstrates superior scalability, especially when handling multiple concurrent connections. Detailed benchmarks are available for further analysis.

Use Cases

MariaDB Vector supports a variety of applications:

  • Recommendation Systems: Build personalized product recommendations based on user preferences and behavior, supporting natural language interactions.
  • Similarity Search: Implement powerful search functionalities to find similar images, documents, or multimedia content. This includes building knowledge bases from documentation or finding related products without manual labeling.
  • Machine Learning: Efficiently store and retrieve vector representations of data for machine learning models, facilitating easy clustering and quick retrieval of closest data points.

How to Use

For developers, integrating MariaDB Vector involves:

  1. Setting up an AI model (e.g., OpenAI, LLama, Hugging Face) to generate vector embeddings.
  2. Adding a VECTOR column to your existing data tables.
  3. Creating a specialized vector index on the new column to enable fast similarity searches.

Information

PublisherFox
PublishedJul 1, 2025