experimental_ivf_index¶
The
experimental_ivf_indexsystem variable controls whether the IVF-FLAT (Inverted File with Flat encoding) vector index plugin is enabled. When set to0(default),CREATE INDEX ... USING ivfflatstatements are rejected. Set it to1before creating or rebuilding an IVF-FLAT index to perform approximate nearest neighbor (ANN) search on vector columns. This is an experimental feature gated by a session-level flag.
The experimental_ivf_index system variable gates access to the IVF-FLAT vector index algorithm
in MatrixOne. IVF-FLAT partitions the vector space into clusters using k-means and searches only
the nearest clusters during query time, offering a memory-efficient alternative to HNSW. Because
this is an experimental feature, the variable defaults to 0 and must be explicitly enabled
before use.
Syntax¶
SET GLOBAL experimental_ivf_index = 0; SET SESSION experimental_ivf_index = 1;
Query the current value:
SHOW VARIABLES LIKE ‘experimental_ivf_index’; SELECT @@experimental_ivf_index;
Arguments¶
Property |
Value |
|---|---|
Variable Type |
|
Scope |
|
Dynamic |
|
Default Value |
|
Optional Value |
|
Examples¶
DROP DATABASE IF EXISTS ivf_demo;
CREATE DATABASE ivf_demo;
USE ivf_demo;
SET experimental_ivf_index = 1;
CREATE TABLE f(a BIGINT PRIMARY KEY, v VECF32(3));
INSERT INTO f VALUES (1, '[1,1,1]'), (2, '[2,2,2]'), (3, '[3,3,3]'), (4, '[8,8,8]');
CREATE INDEX ix USING ivfflat ON f(v) LISTS = 2 OP_TYPE 'vector_l2_ops' KMEANS_TRAIN_PERCENT 5 KMEANS_MAX_ITERATION 20;
SELECT a FROM f ORDER BY L2_DISTANCE(v, '[1,1,1]') ASC LIMIT 2;
SET experimental_ivf_index = 0;
DROP TABLE f;
DROP DATABASE ivf_demo;
Constraints¶
experimental_ivf_indexdefaults to0. AttemptingCREATE INDEX ... USING ivfflatwhile the variable is0causes the operation to fail.IVF-FLAT is a CPU-only algorithm. It does not require GPU hardware.
IVF-FLAT supports the following build-option parameters:
lists,kmeans_train_percent, andkmeans_max_iteration. These can be specified in theCREATE INDEXorALTER TABLE ... ALTER REINDEXstatement.This is an experimental feature. Its behavior, performance characteristics, and API may change in future releases.