Top
Enterprise Postgres 18 Knowledge DataManagement FeatureUser's Guide

5.5.1 Functions

Function

Return type

Description

pgx_list_model_metadata()

SETOF pgx_models

Get a list of imported models.

pgx_get_model_metadata(model_name text)

SETOF pgx_models

Get detailed information of the specified model.

pgx_get_total_model_size()

bigint

Get the total size of the currently loaded model files.

pgx_load_model(model_name text)

void

Execute the load request for the specified model. If the specified model is not imported, and after loading the model specified in the argument, the total size of all loaded models exceeds the value set by the pgx_inference.total_model_size_limit parameter, the execution will fail.

pgx_unload_model(model_name text, force boolean DEFAULT FALSE)

void

Executes the unload request for the specified model. If the specified model is not imported, and there is a vectorizer referencing the specified model, execution will fail. If the argument force is set to true, the unload request is executed forcibly.

pgx_get_model_load_request(model_name text)

SETOF record

Retrieve records from the pgx_model_load_requests table that correspond to the specified model. The model name is returned instead of the model ID.

pgx_list_model_load_requests()

SETOF record

Retrieve load and unload requests for all models. The model name will be returned instead of the model ID.

pgx_drop_model(model_name text)

void

Delete the imported model.

pgx_grant_model_role(user_name text, role text)

void

Grant the privileges held by the specified role to the user specified by user_name. This function can only be executed by the user who performed CREATE EXTENSION for this feature. The role can be specified as model_owner, meaning the model owner, or system_admin, meaning the system administrator.

pgx_revoke_model_role(user_name text, role text)

void

Revoke the privileges held by the specified role from the user specified by user_name. This function can only be executed by the user who created the extension for this feature. The role can be specified as model_owner, meaning the model owner, or system_admin, meaning the system administrator.

pgx_get_function_by_model_name(model_name text)

text

Get the name of the function created for the model specified in model_name.

pgx_onnx_embed(model text, text_to_infer text)

vector

The specified model is used to convert the text specified in text_to_infer into vectors. If the model specified in the model is not imported or is unavailable, the execution will fail.

pgx_launch_load_launcher()

void

Start the load launcher, which is a worker process that executes load processing.

pgx_unload_all_models()

void

Execute unload requests for all models. Even if there is a vectorizer referencing the model, a message will be output and the unload request will be executed. This function can only be executed by the extension owner.

pgx_drop_all_models()

void

All models will be deleted. Even if you are using models with the automatic vectorization feature, a message will be output and deletion will be performed. This function can only be executed by the extension owner. This function should only be used when returning this feature to an unused state.