The INDEX_VECTOR_MEMORY_ADVISOR procedure is used to estimate the memory usage of a vector index before the table is created.
Notice
This procedure uses table statistics to perform its operations. Make sure to run ANALYZE TABLE beforehand to ensure the statistics are up to date.
Syntax
PROCEDURE index_vector_memory_advisor (
IN idx_type VARCHAR(65535),
IN num_vectors BIGINT UNSIGNED,
IN dim_count INT UNSIGNED,
IN dim_type VARCHAR(65535) DEFAULT 'FLOAT32',
IN idx_parameters LONGTEXT DEFAULT NULL,
IN max_tablet_vectors BIGINT UNSIGNED DEFAULT 0)
Parameters
| Parameter | Description |
|---|---|
| idx_type | The index type. Valid values: HNSW, HNSW_SQ, HNSW_BQ, IVF_FLAT, IVF_SQ8, and IVF_PQ. The values are case insensitive. |
| num_vectors | The number of vector data entries. |
| dim_count | The number of vector dimensions. |
| dim_type | The data type of vector elements. The default value is FLOAT32, which is the only supported value. The value is case insensitive. |
| idx_parameters | The index parameters. This refers to the vector index parameter string used when creating the table, such as distance=l2, type=hnsw, lib=vsag. For more information, see Create a vector index. |
| max_tablet_vectors | The maximum number of vector data entries in a partitioned table. The default value is 0, which indicates that the maximum number of vector data entries in a partition is equal to the total number of vector data entries. You can use a partitioned table to reduce the minimum memory requirement when the total number of vector data entries is the same. |
The return value is a string that provides a brief description of the estimated memory usage.
To ensure the successful rebuilding of the vector index, it is recommended that the reserved memory value be greater than the actual memory used by the vector index after it is built. The recommended memory value is related to the maximum number of vectors in a partition.
- For HNSW and HNSW_SQ indexes, the recommended memory value is returned.
- For HNSW_BQ indexes, both the recommended memory value and the actual memory usage after index creation are returned.
- For IVF_FLAT, IVF_SQ8, and IVF_PQ indexes, both the recommended memory value and the actual memory usage after index creation are returned.
Examples
obclient> CALL DBMS_VECTOR.INDEX_VECTOR_MEMORY_ADVISOR('HNSW',1000000,768,'M=10,DISTANCE=L2');
Query OK, 0 rows affected