Pingu
Computer MySQL PostgreSQL Books Publications
Spielereien Kanu Business TopoDB POI Klettersteigen History TransPool Thermal Baden Brokenstuben Goldwaschen
Blog Contact
Shinguz
Google
/ch/open

Code, Vectors & Vision: A MariaDB Meetup with the Founder

MariaDB: Codes Vectors & Visions 2025-05-06, Bremen (Germany)

Slides from Sergei Golubchik (MariaDB Foundation) hopefully here…

MariaDB Vector Tuning

Tuning is hard

  • Many (> 10) algorithm parametrised.
  • Impossible to describe what they do.
  • Complex interaction between parameters.
  • MariaDB solution: Hide that and auto-tune!
SQL> SHOW GLOBAL VARIABLES LIKE 'mhnsw%';
+------------------------+-----------+
| Variable_name          | Value     |
+------------------------+-----------+
| mhnsw_default_distance | euclidean |
| mhnsw_default_m        | 6         |
| mhnsw_ef_search        | 20        |
| mhnsw_max_cache_size   | 16777216  |
+------------------------+-----------+

Vector System Variables

mhnsw_max_cache_size

  • HNSW is in-memory algorithm.
  • Otherwise slow.
  • At least as big as half of the size of the data.
  • Set as large as possible.
  • Grows as needed up to the specified limit.

DISTANCE mhnsw_default_distance

  • euclidean or cosine
  • Depends on the problem area
  • Practically:

cosine (Text) → Images euclidean

Depends on how the vectors were generated.

mhnsw_ef_search and mhnsw_default_m

  • slow and precise ⇔ fast an imprecise
  • fast write / slow search ⇔ slow write / fast search

mhnsw_ef_search affexts only the search.

mhnsw_default_m affects both write and search.

build time vs. recall

M=3..5 ok

M=6 starts exponential growth

M=12 too high

qps vs. recall

Better to increase mhnsw_default_m than mhnsw_ef_search.

Contributing to MariaDB

Oleksandr “Sanja” Byelkin

Bug reporting

https://jira.mariadb.org

A bug should be:

  • Repeatable
  • Repeatable in simple steps
  • Repeatable with a small test case
  • Repeatable and with proposed workaround
  • Repeatable and with propsed fix

Non-programming contribution

Contributing code

  • Google summer of code
  • Breakpoint: my_message_sql(). See also Marcos comment