| title | summary |
|---|---|
RESOURCE_GROUPS |
Learn the `RESOURCE_GROUPS` information_schema table. |
The RESOURCE_GROUPS table shows the information about all resource groups. For more information, see Use Resource Control to Achieve Resource Group Limitation and Flow Control.
Note:
This table is not available on {{{ .starter }}} and {{{ .essential }}} clusters.
USE information_schema;
DESC resource_groups;+-------------+--------------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+------+---------+-------+
| NAME | varchar(32) | NO | | NULL | |
| RU_PER_SEC | varchar(21) | YES | | NULL | |
| PRIORITY | varchar(6) | YES | | NULL | |
| BURSTABLE | varchar(3) | YES | | NULL | |
| QUERY_LIMIT | varchar(256) | YES | | NULL | |
| BACKGROUND | varchar(256) | YES | | NULL | |
+-------------+--------------+------+------+---------+-------+
6 rows in set (0.00 sec)SELECT * FROM information_schema.resource_groups; -- View all resource groups. TiDB has a `default` resource group.+---------+------------+----------+-----------+-------------+------------+
| NAME | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | BACKGROUND |
+---------+------------+----------+-----------+-------------+------------+
| default | UNLIMITED | MEDIUM | UNLIMITED | NULL | NULL |
+---------+------------+----------+-----------+-------------+------------+CREATE RESOURCE GROUP rg1 RU_PER_SEC=1000; -- Create a resource group `rg1`Query OK, 0 rows affected (0.34 sec)SHOW CREATE RESOURCE GROUP rg1; -- Show the definition of the `rg1` resource group+----------------+---------------------------------------------------------------+
| Resource_Group | Create Resource Group |
+----------------+---------------------------------------------------------------+
| rg1 | CREATE RESOURCE GROUP `rg1` RU_PER_SEC=1000 PRIORITY="MEDIUM" |
+----------------+---------------------------------------------------------------+
1 row in set (0.00 sec)SELECT * FROM information_schema.resource_groups WHERE NAME = 'rg1'; -- View the resource groups `rg1`+------+------------+----------+-----------+-------------+------------+
| NAME | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | BACKGROUND |
+------+------------+----------+-----------+-------------+------------+
| rg1 | 1000 | MEDIUM | OFF | NULL | NULL |
+------+------------+----------+-----------+-------------+------------+
1 row in set (0.00 sec)The descriptions of the columns in the RESOURCE_GROUPS table are as follows:
-
NAME: the name of the resource group. -
RU_PER_SEC: the backfilling speed of the resource group. The unit is RU/second, in which RU means Request Unit. -
PRIORITY: the absolute priority of tasks to be processed on TiKV. Different resources are scheduled according to thePRIORITYsetting. Tasks with highPRIORITYare scheduled first. For resource groups with the samePRIORITY, tasks will be scheduled proportionally according to theRU_PER_SECconfiguration. IfPRIORITYis not specified, the default priority isMEDIUM. -
BURSTABLE: whether to allow the resource group to overuse the available remaining system resources. Starting from v9.0.0, the following three modes are supported. If no value is specified forBURSTABLE, theMODERATEDmode is enabled by default.OFF: indicates that the resource group is not allowed to overuse any remaining system resources.MODERATED: indicates that the resource group is allowed to overuse remaining system resources to a limited extent, with priority given to allocated resources within its quota.UNLIMITED: indicates that the resource group can overuse remaining system resources without limitation, and the excess system resources are treated as equal to the resources within the quota during allocation.
Note:
TiDB automatically creates a
defaultresource group during cluster initialization. For this resource group, the default value ofRU_PER_SECisUNLIMITED(equivalent to the maximum value of theINTtype, that is,2147483647) and itsBURSTABLEmode isUNLIMITED. All requests that are not bound to any resource group are automatically bound to thisdefaultresource group. You cannot delete thedefaultresource group, but can modify its RU configuration.