ALTER RESOURCE GROUP

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

ALTER RESOURCE GROUP - 图1

Note

This feature is not available on TiDB Serverless clusters.

Synopsis

AlterResourceGroupStmt

ALTER RESOURCE GROUP - 图2

IfExists

ALTER RESOURCE GROUP - 图3

ResourceGroupName

ALTER RESOURCE GROUP - 图4

ResourceGroupOptionList

ALTER RESOURCE GROUP - 图5

DirectResourceGroupOption

ALTER RESOURCE GROUP - 图6

ResourceGroupPriorityOption

ALTER RESOURCE GROUP - 图7

  1. AlterResourceGroupStmt ::=
  2. "ALTER" "RESOURCE" "GROUP" IfExists ResourceGroupName ResourceGroupOptionList
  3. IfExists ::=
  4. ('IF' 'EXISTS')?
  5. ResourceGroupName ::=
  6. Identifier
  7. ResourceGroupOptionList ::=
  8. DirectResourceGroupOption
  9. | ResourceGroupOptionList DirectResourceGroupOption
  10. | ResourceGroupOptionList ',' DirectResourceGroupOption
  11. DirectResourceGroupOption ::=
  12. "RU_PER_SEC" EqOpt stringLit
  13. | "PRIORITY" EqOpt ResourceGroupPriorityOption
  14. | "BURSTABLE"
  15. ResourceGroupPriorityOption ::=
  16. LOW
  17. | MEDIUM
  18. | HIGH

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.

ALTER RESOURCE GROUP - 图8

Note

The ALTER RESOURCE GROUP statement can only be executed when the global variable tidb_enable_resource_control is set to ON.

Examples

Create a resource group named rg1 and modify its properties.

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