Updated on 2025-03-13 GMT+08:00

AI Feature Functions

  • gs_index_advise(text)

    Description: Recommends an index for a single query statement.

    Parameter: SQL statement string

    Return type: record

    For details, see section "Index-advisor: Index Recommendation > Single-Query Index Recommendation" in Feature Guide.

  • hypopg_create_index(text, [text])

    Description: Creates a virtual index.

    Parameter: character string of the statement for creating an index, level of the created virtual index (optional)

    Return type: record

    For details, see section "Index-advisor: Index Recommendation > Virtual Index" in Feature Guide.

  • hypopg_display_index([text])

    Description: Displays information about all created virtual indexes.

    Parameter: level of the virtual index to be displayed (optional)

    Return type: record

    For details, see section "Index-advisor: Index Recommendation > Virtual Index" in Feature Guide.

  • hypopg_drop_index(oid)

    Description: Deletes a specified virtual index.

    Parameter: OID of the index

    Return type: Boolean

    For details, see section "Index-advisor: Index Recommendation > Virtual Index" in Feature Guide.

  • hypopg_reset_index([text])

    Description: Clears all virtual indexes.

    Parameter: level of the virtual index to be cleared (optional)

    Return type: none

    For details, see section "Index-advisor: Index Recommendation > Virtual Index" in Feature Guide.

  • hypopg_estimate_size(oid)

    Description: Estimates the space required for creating a specified index.

    Parameter: OID of the index

    Return type: int8

    For details, see section "Index-advisor: Index Recommendation > Virtual Index" in Feature Guide.

  • db4ai_predict_by_bool (text, VARIADIC "any")

    Description: Obtains a model whose return value is of the Boolean type for model inference. This function is an internal function. You are advised to use the PREDICT BY syntax for inference.

    Parameter: model name and input column name of the inference task

    Return type: Boolean

    This function is an internal function. You are advised not to use it directly.

  • db4ai_predict_by_float4(text, VARIADIC "any")

    Description: Obtains a model whose return value is of the float4 type for model inference. This function is an internal function. You are advised to use the PREDICT BY syntax for inference.

    Parameter: model name and input column name of the inference task

    Return type: float

    This function is an internal function. You are advised not to use it directly.

  • db4ai_predict_by_float8(text, VARIADIC "any")

    Description: Obtains a model whose return value is of the float8 type for model inference. This function is an internal function. You are advised to use the PREDICT BY syntax for inference.

    Parameter: model name and input column name of the inference task

    Return type: float

    This function is an internal function. You are advised not to use it directly.

  • db4ai_predict_by_int32(text, VARIADIC "any")

    Description: Obtains a model whose return value is of the int32 type for model inference. This function is an internal function. You are advised to use the PREDICT BY syntax for inference.

    Parameter: model name and input column name of the inference task

    Return type: int

    This function is an internal function. You are advised not to use it directly.

  • db4ai_predict_by_int64(text, VARIADIC "any")

    Description: Obtains a model whose return value is of the int64 type for model inference. This function is an internal function. You are advised to use the PREDICT BY syntax for inference.

    Parameter: model name and input column name of the inference task

    Return type: int

    This function is an internal function. You are advised not to use it directly.

  • db4ai_predict_by_numeric(text, VARIADIC "any")

    Description: Obtains a model whose return value is of the numeric type for model inference. This function is an internal function. You are advised to use the PREDICT BY syntax for inference.

    Parameter: model name and input column name of the inference task

    Return type: numeric

    This function is an internal function. You are advised not to use it directly.

  • db4ai_predict_by_text(text, VARIADIC "any")

    Description: Obtains a model whose return value is of the character type for model inference. This function is an internal function. You are advised to use the PREDICT BY syntax for inference.

    Parameter: model name and input column name of the inference task

    Return type: text

    This function is an internal function. You are advised not to use it directly.

  • db4ai_predict_by_float8_array(text, VARIADIC "any")

    Description: Obtains a model whose return value is of the character type for model inference. This function is an internal function. You are advised to use the PREDICT BY syntax for inference.

    Parameter: model name and input column name of the inference task

    Return type: text

    This function is an internal function. You are advised not to use it directly.

  • gs_explain_model(text)

    Description: Obtains the model whose return value is of the character type for text-based model parsing.

    Parameter: model name

    Return type: text

    This function is an internal function and is unavailable in the current version.

  • gs_ai_stats_explain(text, text[])

    Description: Prints the intelligent statistics of multiple columns in the corresponding table and columns on the current node.

    Parameters: table name and column name collection.

    Return type: text

    Example:

    1
    2
    3
    4
    5
    6
    gaussdb=# SET enable_ai_stats=1;
    gaussdb=# drop table db4ai_bayesnet;
    gaussdb=# create table db4ai_bayesnet(attr1 VARCHAR(256), attr2 VARCHAR(256));
    gaussdb=# INSERT INTO db4ai_bayesnet SELECT 'x','x' FROM generate_series(1, 10000) AS s(i);
    gaussdb=# ANALYZE db4ai_bayesnet((attr1,attr2));
    gaussdb=# select gs_ai_stats_explain('db4ai_bayesnet', ARRAY['attr1', 'attr2']);
    
  • ai_watchdog_detection_warnings()

    Description: Obtains the risk alarm information of the AI watchdog.

    Parameter: none

    Return type: record

    Example:

    1
    gaussdb=# select * from ai_watchdog_detection_warnings();
    
  • ai_watchdog_monitor_status(int)

    Description: Obtains the monitoring information of the AI watchdog.

    Parameter: the upper limit of the length of the returned monitoring sequence. The value range is (0,100). The default value is 10.

    Return type: record

    Example:

    1
    gaussdb=# select * from ai_watchdog_monitor_status();
    
  • ai_watchdog_parameters()

    Description: Obtains the internal parameters or status information of the AI watchdog.

    Parameter: none

    Return type: record

    Example:

    1
    gaussdb=# select * from ai_watchdog_parameters();