Vector System Variables
MariaDB starting with 11.7.1
Vectors were introduced in MariaDB 11.7.1
This page documents system variables related to Vectors.
See Server System Variables for a complete list of system variables and instructions on setting them.
Also see the Full list of MariaDB options, system and status variables.
mhnsw_max_cache_size
- Description: Upper limit for one MHNSW vector index cache. This limits the amount of memory that can be used for caching the index, ensuring efficient memory utilization.
- Commandline:
--mhnsw-max-cache-size=#
- Scope: Global
- Dynamic: Yes
- Data Type:
bigint unsigned
- Default Value:
16777216
(16 MB) - Range:
1048576
to18446744073709551615
- Introduced: MariaDB 11.7.1
mhnsw_default_distance
- Description: Specifies the default distance metric for MHNSW vector indexing. This is used when the
DISTANCE
option is not explicitly defined during index creation. - Commandline:
--mhnsw-default-distance=val
- Scope: Global, Session
- Dynamic: Yes
- Data Type:
enum
- Default Value:
euclidean
- Valid Values:
euclidean
Calculates straight-line distance between vectors. Best for spatial data, images, etc, when absolute magnitude matters.cosine
Measures directional similarity between vectors. Ideal for text embeddings, semantic search, and when vector magnitude is less important.
- Introduced: MariaDB 11.7.1
mhnsw_default_m
- Description: Defines the default value for the M parameter in MHNSW vector indexing. The
M
parameter controls the number of connections per layer in the graph structure, influencing the balance between search performance and index size.- Larger
M
→ Better search accuracy, but larger index size and slower updates and searches. - Smaller
M
→ Faster updates and searches, smaller index, but potentially less accurate search.
- Larger
- Commandline:
--mhnsw-default-m=#
- Scope: Global, Session
- Dynamic: Yes
- Data Type:
int unsigned
- Default Value:
6
- Range:
3
to200
- Introduced: MariaDB 11.7.1
mhnsw_ef_search
- Description: Defines the minimal number of result candidates to look for in the vector index for ORDER BY ... LIMIT N queries. The search will never search for less rows than that, even if LIMIT is smaller. This notably improves the search quality at low LIMIT values, at the expense of search time. Higher values may increase search quality but will also impact query performance.
- Commandline:
--mhnsw-ef-search=#
- Scope: Global, Session
- Dynamic: Yes
- Data Type:
int unsigned
- Default Value:
20
- Range:
1
to10000
- Introduced: MariaDB 11.7.1
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.