Skip to content

MDEV-34805 provide various information about vector indexes - #4955

Open
shabbann wants to merge 2 commits into
MariaDB:mainfrom
shabbann:MDEV-34805-provide-various-information-about-vector-indexes
Open

MDEV-34805 provide various information about vector indexes#4955
shabbann wants to merge 2 commits into
MariaDB:mainfrom
shabbann:MDEV-34805-provide-various-information-about-vector-indexes

Conversation

@shabbann

Copy link
Copy Markdown
Contributor

Adds INFORMATION_SCHEMA.VECTOR_INDEXES table exposing statistics for MHNSW vector indexes via a MYSQL_INFORMATION_SCHEMA_PLUGIN registered alongside the existing mhnsw daemon plugin. columns covered: (TABLE_SCHEMA, TABLE_NAME, INDEX_NAME, VECTOR_DIMENSIONS, SUBDIST_ENABLED, INDEX_SIZE, TOTAL_NODES, DELETED_ROWS, MEMORY_SIZE, CACHE_OVERFLOWS).

@shabbann
shabbann force-pushed the MDEV-34805-provide-various-information-about-vector-indexes branch 2 times, most recently from 2591dd6 to da6f17d Compare April 18, 2026 01:22
@vuvova
vuvova requested review from Copilot and vuvova April 18, 2026 11:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an INFORMATION_SCHEMA.VECTOR_INDEXES table to expose runtime/disk statistics for MHNSW vector indexes, implemented as a MYSQL_INFORMATION_SCHEMA_PLUGIN registered alongside the existing mhnsw daemon plugin.

Changes:

  • Add INFORMATION_SCHEMA.VECTOR_INDEXES schema-table plugin and row population logic in sql/vector_mhnsw.cc.
  • Track MHNSW cache overflow events and expose cache memory/node statistics.
  • Add MTR coverage for the new I_S table and update expected outputs.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
sql/vector_mhnsw.cc Adds I_S plugin/table definition + row filler; tracks cache overflows and exposes cache stats.
mysql-test/main/vector.test Adds end-to-end test coverage for INFORMATION_SCHEMA.VECTOR_INDEXES.
mysql-test/main/vector.result Captures expected output for the new test section.
mysql-test/main/information_schema.result Updates global I_S table list expectations to include VECTOR_INDEXES.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sql/vector_mhnsw.cc
Comment thread sql/vector_mhnsw.cc Outdated
}
size_t cache_mem_size()
{
return root_size(&root);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but to avoid taking the lock twice, I'd introduce a method, like info() that takes a lock, reads all values you need, and releases the lock. once.

Comment thread sql/vector_mhnsw.cc Outdated
@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Apr 20, 2026

@gkodinov gkodinov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! This is a preliminary review.

Please:

  • squash the commits into a single commit and have it have a commit message according to the MariaDB condig standards. There's 2 commits currently.
  • make sure the build-bot tests are passing (or at least, not failing because of your changes). Right now there's at least 2 test failures that are related.

@shabbann

shabbann commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

squash the commits into a single commit and have it have a commit message according to the MariaDb condig standards. There's 2 commits currently.

Hi George, Sergei actually asked me (in Zulip) to keep the commits separate to make reviewing easier. I will squash at the end

make sure the build-bot tests are passing (or at least, not failing because of your changes). Right now there's at least 2 test failures that are related.

I'm working on it

@gkodinov gkodinov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please keep working with Serg on the final review.

@vuvova vuvova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments below. If you'd let me, I can apply these changes myself so that you could concentrate on your GSoC project. This way we'll have this ready in time for a 13.1 preview, there're only few days left.

Comment thread mysql-test/main/vector.test Outdated
Comment thread mysql-test/main/vector.test Outdated
Comment thread sql/vector_mhnsw.cc Outdated
Comment thread sql/vector_mhnsw.cc Outdated
Comment thread sql/vector_mhnsw.cc Outdated
Comment thread sql/vector_mhnsw.cc Outdated
}
size_t cache_mem_size()
{
return root_size(&root);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but to avoid taking the lock twice, I'd introduce a method, like info() that takes a lock, reads all values you need, and releases the lock. once.

@shabbann

Copy link
Copy Markdown
Contributor Author

@vuvova I tried to fix them quickly. Feel free to ask me for any edits, or you can do it yourself if it will be quicker.

Comment thread sql/vector_mhnsw.cc Outdated
Comment thread sql/vector_mhnsw.cc Outdated

@gkodinov gkodinov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider rebasing your PR on top of the main branch and resolving the conflicts mentioned.

@vuvova
vuvova force-pushed the MDEV-34805-provide-various-information-about-vector-indexes branch from 2f39416 to d0e8c40 Compare June 17, 2026 10:57
@CLAassistant

CLAassistant commented Jun 17, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ shabbann
❌ vuvova
You have signed the CLA already but the status is still pending? Let us recheck it.

@vuvova

vuvova commented Jun 17, 2026

Copy link
Copy Markdown
Member

Thanks! I've squashed your commits and added post-review commit on top with my (hopefully not controversial) fixes. I intentionally kept it separate to keep your changes clean.

Did not rebase on top of main though

@vuvova vuvova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, but needs to be rebased on top of main

@gkodinov

Copy link
Copy Markdown
Member

I'll do the merge. hang on.

@gkodinov
gkodinov force-pushed the MDEV-34805-provide-various-information-about-vector-indexes branch from 7e6ed9b to 5dae70e Compare June 18, 2026 09:05

@gkodinov gkodinov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. now in testing.

@gkodinov gkodinov assigned elenst and unassigned vuvova Jun 18, 2026
@shabbann

Copy link
Copy Markdown
Contributor Author

sorry I couldn't do the rebase yesterday because I was busy with my graduation project. I will check the build issues

@shabbann

Copy link
Copy Markdown
Contributor Author

The test main.events_processlist (the one that failed in the buildbot) works fine on my device so I think the issue is from the buildbot. @gkodinov could you restart it please?

@gkodinov

Copy link
Copy Markdown
Member

The test main.events_processlist (the one that failed in the buildbot) works fine on my device so I think the issue is from the buildbot. @gkodinov could you restart it please?

yes, this is a know unstable test. I've restarted it.

@vuvova
vuvova force-pushed the MDEV-34805-provide-various-information-about-vector-indexes branch from 0e0e88d to b9d7dd0 Compare July 1, 2026 16:32
@shabbann

shabbann commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@vuvova if you aren't going to do any more changes I could pull and '--record' the tests to fix the buildbot issues

@gkodinov

Copy link
Copy Markdown
Member

FYI: According to our development cycle all testing of features must be completed before 30 Apr, 30 Jul, 30 Nov and 31 Jan (approximate release dates). You might get comments from the tester before that date or your feature will be approved as is and merged. But it'll all likely happen closer to the release date, not right now.

@vuvova
vuvova force-pushed the MDEV-34805-provide-various-information-about-vector-indexes branch 3 times, most recently from 0a0c3e0 to 994c3bd Compare August 14, 2026 09:52
shabbann and others added 2 commits August 14, 2026 14:21
Adds INFORMATION_SCHEMA.VECTOR_INDEXES table exposing statistics for MHNSW vector
indexes via a MYSQL_INFORMATION_SCHEMA_PLUGIN registered alongside
the existing mhnsw daemon plugin. columns covered:
(TABLE_SCHEMA, TABLE_NAME, INDEX_NAME, VECTOR_DIMENSIONS,
SUBDIST_ENABLED, INDEX_SIZE, TOTAL_NODES, DELETED_ROWS,
MEMORY_SIZE, CACHE_OVERFLOWS).
* keep `vec_len >= subdist_part * 2` logic in one place only
* keep "distance-greater-than" mode logic in one place only
* simplify VECTOR_DIMENSIONS (no need to have a special ctx->vec_len
  path if the other one always works)
* new plugin = maturity beta
* remove redundant casts, etc
* moved vector_indexes_fields_enum to the global scope to use it
  for setting schema->idx_field1/schema->idx_field2
* open the hlindex graph table, if needed, otherwise most values
  are unknown unless a user did vector search before
* added TABLE_CATALOG column
* remove CACHE_OVERFLOWS column, doesn't work as implemented,
  the fix is complex and isn't worth it

in the test:
* prefer query_vertical for readability
* select all columns at least once
* select INDEX_SIZE even if engine-dependent, use rdiff files
* test how get_all_tables only open one specific table, and
  even only .frm file, if possible
@vuvova
vuvova force-pushed the MDEV-34805-provide-various-information-about-vector-indexes branch from 994c3bd to 7a32192 Compare August 14, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

6 participants