AnalyticDB for MySQL elastic cluster allows you to execute the ALTER RESOURCE GROUP statement to modify the amount of resources and the query execution mode of resource pools. You can also execute the statement to bind or unbind users to or from resource pools.

Syntax

ALTER RESOURCE GROUP resource_group_name
    [QUERY_TYPE = {interactive, batch, default_type}]
    [NODE_NUM = N]
    [ADD_USER=user_name]
    [DROP_USER=user_name]
  • The operation specified by the ADD_USER or DROP_USER parameter to bind or unbind users to or from a resource pool must be separately performed. You cannot use the two parameters with other properties.
  • Resource pool names are not case-sensitive. For example, test_group and Test_Group indicate the same resource pool. The display name of the resource pool is TEST_GROUP.

Parameters

Parameter Description
QUERY_TYPE The query execution mode. Valid values:
  • interactive
  • batch
  • default_type
Default value: default_type. For more information, see Query execution modes.
NODE_NUM The number of nodes in a resource pool. Default value: 0.
ADD_USER Binds a user to a resource pool.
DROP_USER Unbinds a user from a resource pool.

Examples

  • Modify the amount of resources in a resource pool.

    Execute the following statement to modify the value of the NODE_NUM parameter to 3:

    ALTER RESOURCE GROUP 'BATCH_RG' NODE_NUM=3
  • Modify the query execution mode of a resource pool.

    Execute the following statement to modify the value of the QUERY_TYPE parameter to default_type:

    ALTER RESOURCE GROUP 'BATCH_RG' QUERY_TYPE=default_type
  • Modify the query execution mode and the amount of resources of a resource pool.
    ALTER RESOURCE GROUP 'BATCH_RG' QUERY_TYPE=default_type NODE_NUM=3
  • Bind a user to a resource pool.
    ALTER RESOURCE GROUP 'BATCH_RG' ADD_USER=batch_user
    Notice You cannot use this parameter with other properties. The following statement is invalid:
    ALTER RESOURCE GROUP 'BATCH_RG' ADD_USER=batch_user QUERY_TYPE=default_type
  • Unbind a user from a resource pool.
    ALTER RESOURCE GROUP 'BATCH_RG' DROP_USER=batch_user
  • Modify the query execution mode of the default resource pool.
    -- Execute the following statement to modify the value of the QUERY_TYPE parameter to batch:
    ALTER RESOURCE GROUP user_default QUERY_TYPE=batch
    
    -- Execute the following statement to modify the value of the QUERY_TYPE parameter to default_type:
    ALTER RESOURCE GROUP user_default QUERY_TYPE=default_type
  • View current resource pools.
    SELECT * FROM INFORMATION_SCHEMA.RESOURCE_GROUPS;