Skip to content

PS-11203 Vector Index Syntax#5987

Open
percona-mhansson wants to merge 2 commits into
percona:vector-mvpfrom
percona-mhansson:vector-mvp-syntax
Open

PS-11203 Vector Index Syntax#5987
percona-mhansson wants to merge 2 commits into
percona:vector-mvpfrom
percona-mhansson:vector-mvp-syntax

Conversation

@percona-mhansson

@percona-mhansson percona-mhansson commented May 29, 2026

Copy link
Copy Markdown
Contributor

Stacked on #6000

@percona-mhansson percona-mhansson changed the title Vector mvp syntax PS-11203 Vector Index Syntax May 29, 2026
@percona-mhansson percona-mhansson force-pushed the vector-mvp-syntax branch 3 times, most recently from c055ddc to bac48eb Compare June 9, 2026 13:47
@percona-mhansson percona-mhansson force-pushed the vector-mvp-syntax branch 2 times, most recently from a985587 to 96481cb Compare June 10, 2026 14:24
Vector indexes have the type (algorithm) SE_SPECIFIC, and we add a column option
in the data dictionary saying `vector_index=1;` which gets picked up by
dedicated code in the data dictionary and the handler part of InnoDB.

In the SQL layer, the vector index is very much a thing; there is an
`HA_KEY_ALG_VECTOR`, an `HA_VECTOR` and a `KEYTYPE_VECTOR`.

Extra SQL is added to display the type of a vector index as VECTOR rather than
SE_SPECIFIC.
@percona-mhansson percona-mhansson force-pushed the vector-mvp-syntax branch 4 times, most recently from f0e62ee to 3c65f43 Compare June 23, 2026 14:24
Adding the syntax `TYPE <ident> WITH ( <ident> = <ident>...) ` to index creation
syntax. E.g.:

`CREATE VECTOR INDEX <name> ( <table> ) TYPE hnsw WITH ( M = 6 )`

The syntax in the `WITH` list, christened Index Construction Parameters in this
commit, must be verified by the storage engine. There were no hooks for this in
InnoDB so one has been added in check_engine().  We have to do it fairly early
so that we can prevent table creation in the DD in case of errors.  Hence, the
index type and parameter list are validated inside the storage engine using a
new interface validate_engine_attributes().

In order to leave the DD table definitions unchanged, we employ a couple of
hacks: The index construction parameters are stored as key-value pairs inside
the index's `option` field. The are unpacked from there for `SHOW CREATE TABLE`.

To do: We will probably still need a hook to handle the case of an
already-existing table with invalid attributes; there are no hooks for this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant