Description\n-----------\n\nThis page documents system variables related to Vectors.\n\nSee Server System Variables for instructions on setting them.\n\nAlso see the Full list of MariaDB options, system and status variables.\n\nmhnsw_default_distance\n\n Description: Specifies the default distance metric for MHNSW vector indexing. This is used when the DISTANCE option is not explicitly defined during index creation.\n Command line: --mhnsw-default-distance=val\n Scope: Global, Session\n Dynamic: Yes\n Data Type: enum\n Default Value: euclidean\n Valid Values:\n   euclidean Calculates straight-line distance between vectors. Best for spatial data, images, etc, when absolute magnitude matters.\n   cosine Measures directional similarity between vectors. Ideal for text embeddings, semantic search, and when vector magnitude is less important.\n Introduced: MariaDB 11.7.1\n\nmhnsw_default_m\n\n 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.\n   Larger M → Better search accuracy, but larger index size and slower updates and searches.\n   Smaller M → Faster updates and searches, smaller index, but potentially less accurate search.\n Command line: --mhnsw-default-m=#\n Scope: Global, Session\n Dynamic: Yes\n Data Type: int unsigned\n Default Value: 6\n Range: 3 to 200\n Introduced: MariaDB 11.7.1\n\nmhnsw_ef_search\n\n 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.\n Command line: --mhnsw-ef-search=#\n Scope: Global, Session\n Dynamic: Yes\n Data Type: int unsigned\n Default Value: 20\n Range: 1 to 10000\n Introduced: MariaDB 11.7.1\n\nmhnsw_max_cache_size\n\n 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.\n Command line: --mhnsw-max-cache-size=#\n Scope: Global\n Dynamic: Yes\n Data Type: bigint unsigned\n Default Value: 16777216 (16 MB)\n Range: 1048576 to 18446744073709551615\n Introduced: MariaDB 11.7.1\n\nURL: https://mariadb.com/docs/server/reference/sql-structure/vectors/vector-system-variables