INDEX_VECTOR_MEMORY_ADVISOR

Use the INDEX_VECTOR_MEMORY_ADVISOR procedure to determine the vector memory size needed for a particular vector index. This helps you evaluate the number of indexes that can fit for each simulated vector memory size.

Syntax

  • Using the number and type of vector dimensions that you want to store in your vector index.

    DBMS_VECTOR.INDEX_VECTOR_MEMORY_ADVISOR(
        INDEX_TYPE        IN    VARCHAR2, 
        NUM_VECTORS       IN    NUMBER, 
        DIM_COUNT         IN    NUMBER, 
        DIM_TYPE          IN    VARCHAR2, 
        PARAMETER_JSON    IN    CLOB, 
        RESPONSE_JSON     OUT   CLOB);
  • Using the table and vector column on which you want to create your vector index:

    DBMS_VECTOR.INDEX_VECTOR_MEMORY_ADVISOR(
        TABLE_OWNER        IN    VARCHAR2, 
        TABLE_NAME         IN    VARCHAR2, 
        COLUMN_NAME        IN    VARCHAR2, 
        INDEX_TYPE         IN    VARCHAR2, 
        PARAMETER_JSON     IN    CLOB, 
        RESPONSE_JSON      OUT   CLOB);

Table 12-6 Syntax Details: INDEX_VECTOR_MEMORY_ADVISOR

Parameter Description

INDEX_TYPE

Type of vector index:

  • IVF for Inverted File Flat (IVF) vector indexes

  • HNSW for Hierarchical Navigable Small World (HNSW) vector indexes

NUM_VECTORS

Number of vectors that you plan to create the vector index with.

DIM_COUNT

Number of dimensions of a vector as a NUMBER.

DIM_TYPE

Type of dimensions of a vector. Possible values are:

  • FLOAT16

  • FLOAT32

  • FLOAT64

  • INT8

TABLE_OWNER

Owner name of the table on which to create the vector index.

TABLE_NAME

Table name on which to create the vector index.

COLUMN_NAME

Name of the vector column on which to create the vector index.

PARAMETER_JSON

Input parameter in JSON format. You can specify only one of the following form:

  • PARAMTER_JSON=>{"accuracy":value}

  • INDEX_TYPE=>IVF, parameter_json=>{"neighbor_partitions":value}

  • INDEX_TYPE=>HNSW, parameter_json=>{"neighbors":value}

Note: You cannot specify values for accuracy along with neighbor_partitions or neighbors.

RESPONSE_JSON

JSON-formatted response string.

Examples

  • Using neighbors in the parameters list:

    SET SERVEROUTPUT ON;
    DECLARE
        response_json CLOB;
    BEGIN
        DBMS_VECTOR.INDEX_VECTOR_MEMORY_ADVISOR(
            INDEX_TYPE=>'HNSW', 
            NUM_VECTORS=>10000, 
            DIM_COUNT=>768, 
            DIM_TYPE=>'FLOAT32', 
            PARAMETER_JSON=>'{"neighbors":32}', 
            RESPONSE_JSON=>response_json);
    END;
    /

    Result:

    Suggested vector memory pool size: 59918628 Bytes
  • Using accuracy in the parameters list:

    SET SERVEROUTPUT ON;
    DECLARE
        response_json CLOB;
    BEGIN
        DBMS_VECTOR.INDEX_VECTOR_MEMORY_ADVISOR(
            INDEX_TYPE=>'HNSW', 
            NUM_VECTORS=>10000, 
            DIM_COUNT=>768, 
            DIM_TYPE=>'FLOAT32', 
            PARAMETER_JSON=>'{"accuracy":90}', 
            RESPONSE_JSON=>response_json); 
    END;
    /

    Result:

    Suggested vector memory pool size: 53926765 Bytes
  • Using the table and vector column on which you want to create the vector index:

    SET SERVEROUTPUT ON;
    DECLARE
        response_json CLOB;
    BEGIN
        DBMS_VECTOR.INDEX_VECTOR_MEMORY_ADVISOR(
            'VECTOR_USER', 
            'VECTAB', 
            'DATA_VECTOR', 
            'HNSW', 
            RESPONSE_JSON=>response_json);
    END;
    /

    Example result:

    Using default accuracy: 90% 
    Suggested vector memory pool size: 76396251 Bytes