Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql-infra: add resource control feature #12353

Merged
merged 68 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
896f94c
updated 3 articles
hfxsd Feb 1, 2023
7e7d291
Create sql-statement-alter-resource-group.md
hfxsd Feb 1, 2023
8c6f68e
Update sql-statement-alter-user.md
hfxsd Feb 1, 2023
910f132
added CREATE RESOURCE GROUP
hfxsd Feb 1, 2023
722bd30
translate 6 more docs
hfxsd Feb 1, 2023
72d5153
add part of resource control doc
hfxsd Feb 1, 2023
3862e03
Merge remote-tracking branch 'upstream/master' into resource-control
hfxsd Feb 2, 2023
5647598
finish translation except ru.md
hfxsd Feb 2, 2023
4774963
removed blank line
hfxsd Feb 2, 2023
1971ca2
Apply suggestions from code review
hfxsd Feb 2, 2023
25f2408
Update tidb-resource-control.md
hfxsd Feb 2, 2023
4d59f3b
Update tidb-resource-control.md
hfxsd Feb 2, 2023
589edfb
Apply suggestions from code review
hfxsd Feb 2, 2023
bb2f7e1
Merge remote-tracking branch 'upstream/master' into resource-control
hfxsd Feb 2, 2023
4356301
Merge remote-tracking branch 'upstream/master' into resource-control
hfxsd Feb 3, 2023
d48a5d6
draft done
hfxsd Feb 3, 2023
53822c4
Update tidb-resource-control.md
hfxsd Feb 3, 2023
e405d6e
sync brian's latest updates
hfxsd Feb 3, 2023
9a4f4ba
Update tidb-resource-control.md
hfxsd Feb 6, 2023
f9d992f
Apply suggestions from code review
hfxsd Feb 6, 2023
5fedf74
fix links
hfxsd Feb 6, 2023
413aba2
Update tidb-resource-control.md
hfxsd Feb 6, 2023
60f6d30
translated the newly added content
hfxsd Feb 6, 2023
3b9915b
Apply suggestions from code review
hfxsd Feb 6, 2023
ee9415a
Update TOC.md
hfxsd Feb 7, 2023
464d30c
polished wording
hfxsd Feb 7, 2023
3fa096f
Update tidb-resource-control.md
hfxsd Feb 7, 2023
e522fcd
Update information-schema-resource-groups.md
hfxsd Feb 7, 2023
d93d8a7
Apply suggestions from code review
hfxsd Feb 7, 2023
3c6e57b
Apply suggestions from code review
hfxsd Feb 7, 2023
e897300
Apply suggestions from code review
hfxsd Feb 7, 2023
7c73827
Update system-variables.md
hfxsd Feb 8, 2023
6804d8c
Update tikv-configuration-file.md
hfxsd Feb 8, 2023
0aec93b
Update tidb-resource-control.md
hfxsd Feb 8, 2023
ba6590a
Merge remote-tracking branch 'upstream/master' into resource-control
hfxsd Feb 8, 2023
63381ba
sync cn commits
hfxsd Feb 8, 2023
b1db47c
Apply suggestions from code review
hfxsd Feb 8, 2023
bd7ce25
Apply suggestions from code review
hfxsd Feb 9, 2023
5a1207c
Update tidb-resource-control.md
hfxsd Feb 9, 2023
a46e7a0
Update tidb-resource-control.md
hfxsd Feb 9, 2023
757aa33
Update tidb-resource-control.md
hfxsd Feb 9, 2023
b3d6c4b
Merge remote-tracking branch 'upstream/master' into resource-control
hfxsd Feb 11, 2023
76494af
Apply suggestions from code review
hfxsd Feb 11, 2023
c8edbda
Update grafana-resource-control-dashboard.md
hfxsd Feb 11, 2023
4ea89b4
Apply suggestions from code review
hfxsd Feb 11, 2023
cccc9a2
Update grafana-tikv-dashboard.md
hfxsd Feb 11, 2023
070ea08
Update information-schema-processlist.md
hfxsd Feb 11, 2023
235af05
Update sql-statement-drop-resource-group.md
hfxsd Feb 12, 2023
71c07b0
add the note that this feature does not support serverless tier
hfxsd Feb 15, 2023
7b6e581
Update tidb-resource-control.md
hfxsd Feb 15, 2023
0923d0b
Apply suggestions from code review
hfxsd Feb 15, 2023
cefd18e
Update tidb-resource-control.md
hfxsd Feb 15, 2023
155f791
Update tidb-resource-control.md
hfxsd Feb 15, 2023
0f7a666
Apply suggestions from code review
hfxsd Feb 15, 2023
fa3e83d
Update tidb-resource-control.md
hfxsd Feb 16, 2023
7a59a5b
Update information-schema/information-schema-resource-groups.md
BornChanger Feb 16, 2023
b21d6b7
Update information-schema/information-schema-resource-groups.md
BornChanger Feb 16, 2023
6c6de80
Update sql-statements/sql-statement-alter-resource-group.md
BornChanger Feb 16, 2023
2d1f36d
Update sql-statements/sql-statement-alter-resource-group.md
BornChanger Feb 16, 2023
5e1fd62
Apply suggestions from code review
hfxsd Feb 17, 2023
1c63af5
Apply suggestions from code review
hfxsd Feb 17, 2023
22e2cd1
Update TOC-tidb-cloud.md
hfxsd Feb 17, 2023
c7b13a1
Update TOC-tidb-cloud.md
hfxsd Feb 17, 2023
3ddf4a9
Update tidb-resource-control.md
hfxsd Feb 17, 2023
12e8dc4
Update grafana-resource-control-dashboard.md
hfxsd Feb 17, 2023
c7fd54e
Update grafana-resource-control-dashboard.md
hfxsd Feb 17, 2023
d84412f
add the customcontent for TiDB Cloud
qiancai Feb 17, 2023
0d85e11
Update tidb-resource-control.md
hfxsd Feb 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
- [Back up and Restore Data Using Dumpling and TiDB Lightning](/backup-and-restore-using-dumpling-lightning.md)
- [Back Up and Restore RawKV](/br/rawkv-backup-and-restore.md)
- [Incremental Backup and Restore](/br/br-incremental-guide.md)
- [Resource Control](/tidb-resource-control.md)
- [Configure Time Zone](/configure-time-zone.md)
- [Daily Checklist](/daily-check.md)
- [Maintain TiFlash](/tiflash/maintain-tiflash.md)
Expand Down Expand Up @@ -606,6 +607,7 @@
- [TiKV](/grafana-tikv-dashboard.md)
- [TiFlash](/tiflash/monitor-tiflash.md)
- [TiCDC](/ticdc/monitor-ticdc.md)
- [Resource Control](/grafana-resource-control-dashboard.md)
- Secure
- [Enable TLS Between TiDB Clients and Servers](/enable-tls-between-clients-and-servers.md)
- [Enable TLS Between TiDB Components](/enable-tls-between-components.md)
Expand Down Expand Up @@ -645,6 +647,7 @@
- [`ALTER INDEX`](/sql-statements/sql-statement-alter-index.md)
- [`ALTER INSTANCE`](/sql-statements/sql-statement-alter-instance.md)
- [`ALTER PLACEMENT POLICY`](/sql-statements/sql-statement-alter-placement-policy.md)
- [`ALTER RESOURCE GROUP`](/sql-statements/sql-statement-alter-resource-group.md)
- [`ALTER TABLE`](/sql-statements/sql-statement-alter-table.md)
- [`ALTER TABLE COMPACT`](/sql-statements/sql-statement-alter-table-compact.md)
- [`ALTER USER`](/sql-statements/sql-statement-alter-user.md)
Expand All @@ -660,6 +663,7 @@
- [`CREATE DATABASE`](/sql-statements/sql-statement-create-database.md)
- [`CREATE INDEX`](/sql-statements/sql-statement-create-index.md)
- [`CREATE PLACEMENT POLICY`](/sql-statements/sql-statement-create-placement-policy.md)
- [`CREATE RESOURCE GROUP`](/sql-statements/sql-statement-create-resource-group.md)
- [`CREATE ROLE`](/sql-statements/sql-statement-create-role.md)
- [`CREATE SEQUENCE`](/sql-statements/sql-statement-create-sequence.md)
- [`CREATE TABLE LIKE`](/sql-statements/sql-statement-create-table-like.md)
Expand All @@ -676,6 +680,7 @@
- [`DROP DATABASE`](/sql-statements/sql-statement-drop-database.md)
- [`DROP INDEX`](/sql-statements/sql-statement-drop-index.md)
- [`DROP PLACEMENT POLICY`](/sql-statements/sql-statement-drop-placement-policy.md)
- [`DROP RESOURCE GROUP`](/sql-statements/sql-statement-drop-resource-group.md)
- [`DROP ROLE`](/sql-statements/sql-statement-drop-role.md)
- [`DROP SEQUENCE`](/sql-statements/sql-statement-drop-sequence.md)
- [`DROP STATS`](/sql-statements/sql-statement-drop-stats.md)
Expand Down Expand Up @@ -727,6 +732,7 @@
- [`SHOW CONFIG`](/sql-statements/sql-statement-show-config.md)
- [`SHOW CREATE DATABASE`](/sql-statements/sql-statement-show-create-database.md)
- [`SHOW CREATE PLACEMENT POLICY`](/sql-statements/sql-statement-show-create-placement-policy.md)
- [`SHOW CREATE RESOURCE GROUP`](/sql-statements/sql-statement-show-create-resource-group.md)
- [`SHOW CREATE SEQUENCE`](/sql-statements/sql-statement-show-create-sequence.md)
- [`SHOW CREATE TABLE`](/sql-statements/sql-statement-show-create-table.md)
- [`SHOW CREATE USER`](/sql-statements/sql-statement-show-create-user.md)
Expand Down Expand Up @@ -852,6 +858,7 @@
- [`PLACEMENT_POLICIES`](/information-schema/information-schema-placement-policies.md)
- [`PROCESSLIST`](/information-schema/information-schema-processlist.md)
- [`REFERENTIAL_CONSTRAINTS`](/information-schema/information-schema-referential-constraints.md)
- [`RESOURCE_GROUPS`](/information-schema/information-schema-resource-groups.md)
- [`SCHEMATA`](/information-schema/information-schema-schemata.md)
- [`SEQUENCES`](/information-schema/information-schema-sequences.md)
- [`SESSION_VARIABLES`](/information-schema/information-schema-session-variables.md)
Expand Down
36 changes: 36 additions & 0 deletions grafana-resource-control-dashboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
title: Key Monitoring Metrics of Resource Control
summary: Learn some key metrics displayed on the Grafana Resource Control dashboard.
---

# Key Monitoring Metrics of Resource Control

If you use TiUP to deploy the TiDB cluster, the monitoring system (Prometheus & Grafana) is deployed at the same time. For more information, see [Overview of the Monitoring Framework](/tidb-monitoring-framework.md).

The Grafana dashboard is divided into a series of sub dashboards which include Overview, PD, TiDB, TiKV, Node\_exporter, Disk Performance, and Performance\_overview. A lot of metrics are there to help you diagnose.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

You can get an overview of the resource control status from the PD dashboard, where the key metrics are displayed. This document provides a detailed description of these key metrics.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

This document describes some key monitoring metrics displayed on the Resource Control Dashboard.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

## Metrics about Request Unit

- RU: the [Request Unit (RU)](/tidb-resource-control.md#what-is-request-unit-ru) consumption information of each resource group is calculated in real time. `total` is the sum of the Request Units consumed by all Resource Groups. The Request Unit consumption of each resource group should be equal to the sum of its read consumption (Read Request Unit) and write consumption (Write Request Unit).
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- RU Per Query: the average number of Request Units consumed by each SQL statement per second. It is obtained by dividing the above Request Unit by the number of SQL statements executed per second.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- RRU: the Read Request Unit consumption information of each resource group is calculated in real time. `total` is the sum of the Read Request Units consumed by all Resource Groups.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- RRU Per Query: the average number of Read Request Units consumed by each SQL statement per second. It is obtained by dividing the above Read Request Unit by the number of SQL statements executed per second.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- WRU: the Write Request Unit consumption information of each resource group is calculated in real time. `total` is the sum of the Write Request Units consumed by all Resource Groups.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- WRU Per Query: the average number of Write Request Units consumed by each SQL statement per second. It is obtained by dividing the above Write Request Unit by the number of SQL statements executed per second.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

## Metrics about resources

- KV Request Count: the number of KV requests is calculated in real time for each resource group. They are divided into read and write types. `total` is the sum of the KV requests involved by all Resource Groups.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- KV Request Count Per Query: the average number of read and write KV requests by each SQL statement per second. It is obtained by dividing the above KV Request Count by the number of SQL statements executed per second.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- Bytes Read: the amount of data read is calculated in real time for each resource group. `total` is the sum of the data read by all Resource Groups.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- Bytes Read Per Query: the average amount of data read by each SQL statement per second. It is obtained by dividing the above Bytes Read by the number of SQL statements executed per second.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- Bytes Written: the amount of data written is calculated in real time for each resource group. `total` is the sum of the data written by all Resource Groups.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- Bytes Written Per Query: the average amount of data written by each SQL statement per second. It is obtained by dividing the above Bytes Written by the number of SQL statements executed per second.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- KV CPU Time: the KV layer CPU time consumed is calculated in real time for each resource group. `total` is the sum of the KV layer CPU time consumed by all Resource Groups.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- KV CPU Time Per Query: the average KV layer CPU time consumed by each SQL statement per second. It is obtained by dividing the above KV CPU Time by the number of SQL statements executed per second.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- SQL CPU Time: the SQL layer CPU time consumed is calculated in real time for each resource group. `total` is the sum of the SQL layer CPU time consumed by all Resource Groups.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
- SQL CPU Time Per Query: the average SQL layer CPU time consumed by each SQL statement per second. It is obtained by dividing the above SQL CPU Time by the number of SQL statements executed per second.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
86 changes: 46 additions & 40 deletions information-schema/information-schema-processlist.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ The `PROCESSLIST` table has additional columns not present in `SHOW PROCESSLIST`
* A `DIGEST` column to show the digest of the SQL statement.
* A `MEM` column to show the memory used by the request that is being processed, in bytes.
* A `DISK` column to show the disk usage in bytes.
* A `TxnStart` column to show the start time of the transaction
* A `TxnStart` column to show the start time of the transaction.
* A `RESOURCE_GROUP` column to show the resource group name.

{{< copyable "sql" >}}

Expand All @@ -21,44 +22,47 @@ USE information_schema;
DESC processlist;
```

```
+----------+---------------------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------------------+------+------+---------+-------+
| ID | bigint(21) unsigned | NO | | 0 | |
| USER | varchar(16) | NO | | | |
| HOST | varchar(64) | NO | | | |
| DB | varchar(64) | YES | | NULL | |
| COMMAND | varchar(16) | NO | | | |
| TIME | int(7) | NO | | 0 | |
| STATE | varchar(7) | YES | | NULL | |
| INFO | longtext | YES | | NULL | |
| DIGEST | varchar(64) | YES | | | |
| MEM | bigint(21) unsigned | YES | | NULL | |
| DISK | bigint(21) unsigned | YES | | NULL | |
| TxnStart | varchar(64) | NO | | | |
+----------+---------------------+------+------+---------+-------+
12 rows in set (0.00 sec)
```sql
+---------------------+---------------------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+---------------------+------+------+---------+-------+
| ID | bigint(21) unsigned | NO | | 0 | |
| USER | varchar(16) | NO | | | |
| HOST | varchar(64) | NO | | | |
| DB | varchar(64) | YES | | NULL | |
| COMMAND | varchar(16) | NO | | | |
| TIME | int(7) | NO | | 0 | |
| STATE | varchar(7) | YES | | NULL | |
| INFO | longtext | YES | | NULL | |
| DIGEST | varchar(64) | YES | | | |
| MEM | bigint(21) unsigned | YES | | NULL | |
| DISK | bigint(21) unsigned | YES | | NULL | |
| TxnStart | varchar(64) | NO | | | |
| RESOURCE_GROUP | varchar(32) | NO | | | |
+---------------------+---------------------+------+------+---------+-------+
13 rows in set (0.00 sec)
```

{{< copyable "sql" >}}

```sql
SELECT * FROM processlist\G
```

```
```sql
*************************** 1. row ***************************
ID: 16
USER: root
HOST: 127.0.0.1
DB: information_schema
COMMAND: Query
TIME: 0
STATE: autocommit
INFO: SELECT * FROM processlist
MEM: 0
TxnStart:
ID: 2300033189772525975
USER: root
HOST: 127.0.0.1:51289
DB: NULL
COMMAND: Query
TIME: 0
STATE: autocommit
INFO: SELECT * FROM processlist
DIGEST: dbfaa16980ec628011029f0aaf0d160f4b040885240dfc567bf760d96d374f7e
MEM: 0
DISK: 0
TxnStart:
RESOURCE_GROUP: rg1
1 row in set (0.00 sec)
```

Expand All @@ -76,6 +80,7 @@ Fields in the `PROCESSLIST` table are described as follows:
* MEM: The memory used by the request that is being processed, in bytes.
* DISK: The disk usage in bytes.
* TxnStart: The start time of the transaction.
* RESOURCE_GROUP: The resource group name.

## CLUSTER_PROCESSLIST

Expand All @@ -88,13 +93,14 @@ SELECT * FROM information_schema.cluster_processlist;
```

```sql
+-----------------+-----+------+----------+------+---------+------+------------+------------------------------------------------------+-----+----------------------------------------+
| INSTANCE | ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO | MEM | TxnStart |
+-----------------+-----+------+----------+------+---------+------+------------+------------------------------------------------------+-----+----------------------------------------+
| 10.0.1.22:10080 | 150 | u1 | 10.0.1.1 | test | Query | 0 | autocommit | select count(*) from usertable | 372 | 05-28 03:54:21.230(416976223923077223) |
| 10.0.1.22:10080 | 138 | root | 10.0.1.1 | test | Query | 0 | autocommit | SELECT * FROM information_schema.cluster_processlist | 0 | 05-28 03:54:21.230(416976223923077220) |
| 10.0.1.22:10080 | 151 | u1 | 10.0.1.1 | test | Query | 0 | autocommit | select count(*) from usertable | 372 | 05-28 03:54:21.230(416976223923077224) |
| 10.0.1.21:10080 | 15 | u2 | 10.0.1.1 | test | Query | 0 | autocommit | select max(field0) from usertable | 496 | 05-28 03:54:21.230(416976223923077222) |
| 10.0.1.21:10080 | 14 | u2 | 10.0.1.1 | test | Query | 0 | autocommit | select max(field0) from usertable | 496 | 05-28 03:54:21.230(416976223923077225) |
+-----------------+-----+------+----------+------+---------+------+------------+------------------------------------------------------+-----+----------------------------------------+
+-----------------+-----+------+----------+------+---------+------+------------+------------------------------------------------------+-----+----------------------------------------+----------------+
| INSTANCE | ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO | MEM | TxnStart | RESOURCE_GROUP |
+-----------------+-----+------+----------+------+---------+------+------------+------------------------------------------------------+-----+----------------------------------------+----------------+

| 10.0.1.22:10080 | 150 | u1 | 10.0.1.1 | test | Query | 0 | autocommit | select count(*) from usertable | 372 | 05-28 03:54:21.230(416976223923077223) | default |
| 10.0.1.22:10080 | 138 | root | 10.0.1.1 | test | Query | 0 | autocommit | SELECT * FROM information_schema.cluster_processlist | 0 | 05-28 03:54:21.230(416976223923077220) | rg1 |
| 10.0.1.22:10080 | 151 | u1 | 10.0.1.1 | test | Query | 0 | autocommit | select count(*) from usertable | 372 | 05-28 03:54:21.230(416976223923077224) | rg2 |
| 10.0.1.21:10080 | 15 | u2 | 10.0.1.1 | test | Query | 0 | autocommit | select max(field0) from usertable | 496 | 05-28 03:54:21.230(416976223923077222) | default |
| 10.0.1.21:10080 | 14 | u2 | 10.0.1.1 | test | Query | 0 | autocommit | select max(field0) from usertable | 496 | 05-28 03:54:21.230(416976223923077225) | default |
+-----------------+-----+------+----------+------+---------+------+------------+------------------------------------------------------+-----+----------------------------------------+----------------+
```
57 changes: 57 additions & 0 deletions information-schema/information-schema-resource-groups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: RESOURCE_GROUPS
summary: Learn the `RESOURCE_GROUPS` information_schema table.
---

# RESOURCE_GROUPS

> **Warning:**
>
> This feature is experimental and its form and usage may change in subsequent versions.
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

The `RESOURCE_GROUPS` table shows information about all resource groups. See [Use Resource Control to Achieve Resource Isolation](/tidb-resource-control.md).
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

```sql
USE information_schema;
DESC resource_groups;
```

```sql
+------------+-------------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+------+---------+-------+
| NAME | varchar(32) | NO | | NULL | |
| RU_PER_SEC | bigint(21) | YES | | NULL | |
| RU_TOKENS | bigint(21) | YES | | NULL | |
| BURSTABLE | varchar(3) | YES | | NULL | |
+------------+-------------+------+------+---------+-------+
4 rows in set (0.00 sec)
BornChanger marked this conversation as resolved.
Show resolved Hide resolved
```

## Examples

{{< copyable "sql" >}}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{< copyable "sql" >}}

```sql
mysql> CREATE RESOURCE GROUP rg1 RU_PER_SEC=1000; -- Create the resource group rg1
Query OK, 0 rows affected (0.34 sec)
mysql> SHOW CREATE RESOURCE GROUP rg1; -- Displays the definition of the rg1 resource group.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
mysql> SHOW CREATE RESOURCE GROUP rg1; -- Displays the definition of the rg1 resource group.
mysql> SHOW CREATE RESOURCE GROUP rg1; -- Display the definition of the rg1 resource group

+----------------+---------------------------------------------+
| Resource_Group | Create Resource Group |
+----------------+---------------------------------------------+
| rg1 | CREATE RESOURCE GROUP `rg1` RU_PER_SEC=1000 |
+----------------+---------------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT * FROM information_schema.resource_groups WHERE NAME = 'rg1';
+------+------------+-----------+-----------+
| NAME | RU_PER_SEC | RU_TOKENS | BURSTABLE |
+------+------------+-----------+-----------+
| rg1 | 1000 | 100000 | NO |
+------+------------+-----------+-----------+

hfxsd marked this conversation as resolved.
Show resolved Hide resolved
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](/tidb-resource-control.md#what-is-request-unit-ru).
* `RU_TOKENS`: the number of tokens left in the resource group token bucket, and 1 token is 1 RU.
* `BURSTABLE`: whether to allow the resource group to overuse the available system resources.
12 changes: 12 additions & 0 deletions privilege-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,18 @@ Requires `SUPER` privilege.

Requires `SUPER` or `CONNECTION_ADMIN` privilege to kill other user sessions.

### CREATE RESOURCE GROUP

Requires `SUPER` or `RESOURCE_GROUP_ADMIN` privilege.

### ALTER RESOURCE GROUP

Requires `SUPER` or `RESOURCE_GROUP_ADMIN` privilege.

### DROP RESOURCE GROUP

Requires `SUPER` or `RESOURCE_GROUP_ADMIN` privilege.

## Implementation of the privilege system

### Privilege table
Expand Down
Loading