Updated on 2025-05-29 GMT+08:00

SPM Functions

Currently, the SPM feature is not supported in the distributed system. Therefore, when the following functions are called in the distributed system, an error message is displayed, indicating that the SPM feature is not supported in the distributed system.

GS_SPM_EVOLUTE_PLAN(sql_hash, plan_hash)

Description: GS_SPM_EVOLUTE_PLAN belongs to the DBE_SQL_UTIL schema and is a function used by the SPM feature to plan evolution.

Parameters: For details about the parameters, see Table 1 GS_SPM_EVOLUTE_PLAN input parameters and return values.

Table 1 GS_SPM_EVOLUTE_PLAN input parameters and return values

Parameter

Type

Description

Value Range

sql_hash

IN bigint

Specifies a hash value of SQL text.

-

plan_hash

IN bigint

Specifies a hash value of the outline text of the SQL plan.

-

evolute_status

OUT boolean

Determines whether the evolution is complete. t indicates normal. If an exception occurs, an error is reported.

t/f

Return type: Boolean

GS_SPM_SET_PLAN_STATUS(sql_hash, plan_hash, plan_status)

Description: GS_SPM_SET_PLAN_STATUS belongs to the DBE_SQL_UTIL schema and is a function used by the SPM feature to change the baseline status.

Parameters: For details about the parameters, see Table 3 GS_SPM_SET_PLAN_STATUS input parameters and return values.

Table 2 GS_SPM_SET_PLAN_STATUS input parameters and return values

Parameter

Type

Description

Value Range

sql_hash

IN bigint

Specifies a hash value of SQL text.

-

plan_hash

IN bigint

Specifies a hash value of the outline text of the SQL plan.

-

plan_status

IN text

Specifies the status of a plan.

  • ACC: indicates that the plan has been accepted.
  • UNACC: indicates that the plan is not accepted.
  • FIXED: indicates a special ACC plan. The matching priority of this plan is higher than that of other ACC plans.

execute_status

OUT boolean

Determines whether the plan status change is complete. t indicates normal. If an exception occurs, an error is reported.

t/f

Return type: Boolean

GS_SPM_DISPLAY_PLANS(sql_hash)

Description: GS_SPM_DISPLAY_PLANS belongs to the DBE_SQL_UTIL schema and is a function used by the SPM feature to view all baselines of a single SQL statement.

Parameters: For details, see Table 4 GS_SPM_DISPLAY_PLANS input parameters and return values.

Table 3 GS_SPM_DISPLAY_PLANS input parameters and return values

Parameter

Type

Description

Value Range

sql_hash

IN bigint

Unique ID of an SQL statement.

-

sql_hash

OUT bigint

Specifies a hash value of SQL text.

-

plan_hash

OUT bigint

Specifies a hash value of the outline text of the SQL plan.

-

outline

OUT text

Specifies the combination character string of all hints of the outline corresponding to the current plan.

-

cost

OUT double

Specifies the cost of the current plan.

-

status

OUT text

Specifies the status of the current plan.

  • ACC: indicates that the plan has been accepted.
  • UNACC: indicates that the plan is not accepted.
  • FIXED: indicates a special ACC plan. The matching priority of this plan is higher than that of other ACC plans.

gplan

OUT boolean

Determines whether the current plan is a gplan. t indicates gplan. If an exception occurs, an error is reported.

t/f

Return type: bigint, text, double, text, Boolean

GS_SPM_RELOAD_PLAN(sql_hash, plan_hash)

Description: GS_SPM_RELOAD_PLAN belongs to the DBE_SQL_UTIL schema and is a function used by the SPM feature to load a baseline in the baseline system catalog to the SPM global cache.

Parameters: For details, see Table 5 GS_SPM_RELOAD_PLAN input parameters and return values.

Table 4 GS_SPM_RELOAD_PLAN input parameters and return values

Parameter

Type

Description

Value Range

sql_hash

IN bigint

Specifies a hash value of SQL text.

-

plan_hash

IN bigint

Specifies a hash value of the outline text of the SQL plan.

-

execute_status

OUT boolean

Determines whether the baseline loading is complete. t indicates normal. If an exception occurs, an error is reported.

t/f

Return type: Boolean

GS_SPM_VALIDATE_PLAN(sql_hash, plan_hash)

Description: GS_SPM_VALIDATE_PLAN belongs to the DBE_SQL_UTIL schema and is a function used by the SPM feature to verify plan availability.

Parameters: For details about the parameters, see Table 9 GS_SPM_VALIDATE_PLAN input parameters and return values.

Table 5 GS_SPM_VALIDATE_PLAN input parameters and return values

Parameter

Type

Description

Value Range

sql_hash

IN bigint

Specifies a hash value of SQL text.

-

plan_hash

IN bigint

Specifies a hash value of the outline text of the SQL plan.

-

execute_status

OUT boolean

Determines whether the verified plan is available:

t: The verified plan is available. f: The verified plan is unavailable.

t/f

Return type: Boolean

GS_SPM_DELETE_PLAN(sql_hash, plan_hash)

Description: GS_SPM_DELETE_PLAN belongs to DBE_SQL_UTIL schema and is a function used by the SPM feature to delete the plan baseline.

Parameters: For details about the parameters, see Table 10 GS_SPM_DELETE_PLAN input parameters and return values.

Table 6 GS_SPM_DELETE_PLAN input parameters and return values

Parameter

Type

Description

Value Range

sql_hash

IN bigint

Specifies a hash value of SQL text.

-

plan_hash

IN bigint

Specifies a hash value of the outline text of the SQL plan.

-

execute_status

OUT boolean

Determines whether the plan deletion is complete. t indicates normal. If an exception occurs, an error is reported.

t/f

Return type: Boolean