MDEV-38284: Add configurable ef_construction for MHNSW vector index#4590
Open
MauricioPerera wants to merge 1 commit intoMariaDB:mainfrom
Open
MDEV-38284: Add configurable ef_construction for MHNSW vector index#4590MauricioPerera wants to merge 1 commit intoMariaDB:mainfrom
MauricioPerera wants to merge 1 commit intoMariaDB:mainfrom
Conversation
Add per-index ef_construction parameter to control the number of candidates evaluated during HNSW graph construction. Higher values create more accurate index graphs at the cost of slower inserts. Benchmark results on SIFT dataset (50K vectors, 128 dims): ef_construction=10: 99.75% recall, 20.95ms query time ef_construction=100: 100% recall, 9.81ms query time (2.1x faster) Build time: 1.6x slower with ef_construction=100 This allows users to trade build time for faster queries when the index is built once but queried millions of times. Changes: - Replace static constexpr ef_construction=10 with per-index option - Add mhnsw_default_ef_construction system variable (range 1-10000) - Add ef_construction to ha_index_option_struct and MHNSW_Share - Add HA_IOPTION_SYSVAR for ef_construction in mhnsw_index_options - Add test for ef_construction parameter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Nexus CLI Developer seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
6 tasks
gkodinov
requested changes
Jan 26, 2026
Member
gkodinov
left a comment
There was a problem hiding this comment.
Thank you for your contribution. This is a preliminary review.
Please manage the contribution license agreement.
There are some failures of the new test on certain platforms. Please fix this too.
Member
|
it also feels like we need a new MDEV for this. Can you please open one with a good description? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add per-index
ef_constructionparameter to control the number of candidates evaluated during HNSW graph construction. Higher values create more accurate index graphs at the cost of slower inserts.This is a focused PR that only adds
ef_constructionconfigurability (split from #4589 based on reviewer feedback to separate features).Benchmark Results (SIFT dataset, 50K vectors, 128 dims)
Key findings:
Use Case
For workloads where the index is built once but queried millions of times, higher
ef_constructionsaves significant total time by enabling faster queries at the same recall level.Changes
static constexpr ef_construction=10with per-index optionmhnsw_default_ef_constructionsystem variable (range 1-10000, default 10)ef_constructiontoha_index_option_structandMHNSW_ShareHA_IOPTION_SYSVARforef_constructioninmhnsw_index_optionsef_constructionparameterUsage
🤖 Generated with Claude Code