Updated on 2024-06-03 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 an API function used by the SPM feature to plan evolution.

    Parameters: For details, see Table 1.

    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 an API function used by the SPM feature to change the baseline status.

    Parameters: For details, see Table 2.

    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 an API function used by the SPM feature to view all baselines of a single SQL statement.

    Parameters: For details, see Table 3.

    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 an API 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 4.

    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 an API function used by the SPM feature to verify plan availability.

    Parameters: For details, see Table 5.

    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 an API function used by the SPM feature to delete the plan baseline.

    Parameters: For details, see Table 6.

    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