ALTER RESOURCE GROUP

The ALTER RESOURCE GROUP statement is used to modify a resource group in a database.

Synopsis

AlterResourceGroupStmt
ALTERRESOURCEGROUPIfExistsResourceGroupNameResourceGroupOptionList
IfExists
IFEXISTS
ResourceGroupName
Identifier
ResourceGroupOptionList
DirectResourceGroupOptionResourceGroupOptionListDirectResourceGroupOptionResourceGroupOptionList,DirectResourceGroupOption
DirectResourceGroupOption
RU_PER_SECEqOptstringLitPRIORITYEqOptResourceGroupPriorityOptionBURSTABLE
ResourceGroupPriorityOption
LOWMEDIUMHIGH

TiDB supports the following DirectResourceGroupOption, where Request Unit (RU) is a unified abstraction unit in TiDB for CPU, IO, and other system resources.

OptionDescriptionExample
RU_PER_SECRate of RU backfilling per secondRU_PER_SEC = 500 indicates that this resource group is backfilled with 500 RUs per second
PRIORITYThe absolute priority of tasks to be processed on TiKVPRIORITY = HIGH indicates that the priority is high. If not specified, the default value is MEDIUM.
BURSTABLEIf the BURSTABLE attribute is set, TiDB allows the corresponding resource group to use the available system resources when the quota is exceeded.

Examples

Create a resource group named rg1 and modify its properties.

DROP RESOURCE GROUP IF EXISTS rg1;
Query OK, 0 rows affected (0.22 sec)
CREATE RESOURCE GROUP IF NOT EXISTS rg1 RU_PER_SEC = 100 BURSTABLE;
Query OK, 0 rows affected (0.08 sec)
SELECT * FROM information_schema.resource_groups WHERE NAME ='rg1'; +------+------------+----------+-----------+ | NAME | RU_PER_SEC | PRIORITY | BURSTABLE | +------+------------+----------+-----------+ | rg1 | 100 | MEDIUM | YES | +------+------------+----------+-----------+ 1 rows in set (1.30 sec)
ALTER RESOURCE GROUP rg1 RU_PER_SEC = 200 PRIORITY = LOW;
Query OK, 0 rows affected (0.08 sec)
SELECT * FROM information_schema.resource_groups WHERE NAME ='rg1';
+------+------------+----------+-----------+ | NAME | RU_PER_SEC | PRIORITY | BURSTABLE | +------+------------+----------+-----------+ | rg1 | 200 | LOW | NO | +------+------------+----------+-----------+ 1 rows in set (1.30 sec)

MySQL compatibility

MySQL also supports ALTER RESOURCE GROUP. However, the acceptable parameters are different from that of TiDB so that they are not compatible.

See also