Vector System Variables

This page documents system variables related to Vectors.
See Server System Variables for instructions on setting them.
Also see the Full list of MariaDB options, system and status variables.
mhnsw_default_distance
mhnsw_default_distanceDescription: Specifies the default distance metric for MHNSW vector indexing. This is used when the
DISTANCEoption is not explicitly defined during index creation.Command line:
--mhnsw-default-distance=valScope: Global, Session
Dynamic: Yes
Data Type:
enumDefault Value:
euclideanValid Values:
euclideanCalculates straight-line distance between vectors. Best for spatial data, images, etc, when absolute magnitude matters.cosineMeasures 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
mhnsw_default_mDescription: Defines the default value for the M parameter in MHNSW vector indexing. The
Mparameter 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.
Command line:
--mhnsw-default-m=#Scope: Global, Session
Dynamic: Yes
Data Type:
int unsignedDefault Value:
6Range:
3to200Introduced: MariaDB 11.7.1
mhnsw_ef_search
mhnsw_ef_searchDescription: 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.
Command line:
--mhnsw-ef-search=#Scope: Global, Session
Dynamic: Yes
Data Type:
int unsignedDefault Value:
20Range:
1to10000Introduced: MariaDB 11.7.1
mhnsw_max_cache_size
mhnsw_max_cache_sizeDescription: 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.
Command line:
--mhnsw-max-cache-size=#Scope: Global
Dynamic: Yes
Data Type:
bigint unsignedDefault Value:
16777216(16 MB)Range:
1048576to18446744073709551615Introduced: MariaDB 11.7.1
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?

