All Products
Search
Document Center

AnalyticDB:ALTER RESOURCE GROUP

Last Updated:Nov 10, 2023

AnalyticDB for MySQL Data Warehouse Edition (V3.0) allows you to execute the ALTER RESOURCE GROUP statement to modify the amount of resources, query execution mode, and association between database accounts and resource groups.

Prerequisites

Your AnalyticDB for MySQL cluster must meet the following requirements:

  • The cluster is of Data Warehouse Edition (V3.0).

  • The cluster is in elastic mode for Cluster Edition.

  • The cluster has 32 cores or more.

  • The minor version of the cluster is 3.1.3.2 or later.

    Note For information about how to query the minor version of a cluster, see How do I query the version of an AnalyticDB for MySQL cluster? To update the minor version of a cluster, contact technical support.

Syntax

ALTER RESOURCE GROUP resource_group_name
    [QUERY_TYPE = {interactive, batch, default_type}]
    [NODE_NUM = N]
    [ADD_USER=user_name]
    [DROP_USER=user_name]
  • When you specify the ADD_USER or DROP_USER parameter, you cannot modify other attributes of the resource group.

  • Resource group names are not case-sensitive. For example, test_group and Test_Group indicate the same resource group. The resource group is displayed as TEST_GROUP in uppercase.

Parameters

Parameter

Description

QUERY_TYPE

The query execution mode of the resource group. Valid values:

  • interactive

  • batch

  • default_type

Default value: default_type. For more information, see Query execution modes.

NODE_NUM

The number of compute nodes in the resource group. Default value: 0.

ADD_USER

Associates a database account with the resource group.

DROP_USER

Disassociates a database account from the resource group.

Examples

  • Modify the amount of resources in a resource group.

    Set the number of compute nodes in the resource group to 3.

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

    Set the query execution mode of the resource group to the default value.

    ALTER RESOURCE GROUP 'BATCH_RG' QUERY_TYPE=default_type;
  • Modify the query execution mode and the amount of resources for a resource group.

    ALTER RESOURCE GROUP 'BATCH_RG' QUERY_TYPE=default_type NODE_NUM=3;
  • Associate a database account with a resource group.

    ALTER RESOURCE GROUP 'BATCH_RG' ADD_USER=batch_user;
    Important

    When you specify the ADD_USER or DROP_USER parameter, you cannot modify other attributes of the resource group. Otherwise, the execution of the statement fails. Example:

    ALTER RESOURCE GROUP 'BATCH_RG' ADD_USER=batch_user QUERY_TYPE=default_type;
  • Disassociate a database account from a resource group.

    ALTER RESOURCE GROUP 'BATCH_RG' DROP_USER=batch_user;
  • Modify the query execution mode of the default resource group.

    -- Set the query execution mode of the default resource group to batch.
    ALTER RESOURCE GROUP user_default QUERY_TYPE=batch;
    -- Set the query execution mode of the default resource group to the default value.
    ALTER RESOURCE GROUP user_default QUERY_TYPE=default_type;
  • View the current resource groups.

    SELECT * FROM INFORMATION_SCHEMA.RESOURCE_GROUPS;