TiDBTiDB Docs Dash 2024

Jan 9 - Jan 12 (UTC)
Join us to improve docs and win a prize!
Sign InTry Free

SET RESOURCE GROUP

SET RESOURCE GROUP is used to set the resource group for the current session.

Synopsis

SetResourceGroupStmt:

SetResourceGroupStmt
SETRESOURCEGROUPResourceGroupName
ResourceGroupName
Identifier

Examples

Create a user user1, create two resource groups rg1 and rg2, and bind the user user1 to the resource group rg1.

CREATE USER 'user1'; CREATE RESOURCE GROUP 'rg1' RU_PER_SEC = 1000; ALTER USER 'user1' RESOURCE GROUP `rg1`;

Use user1 to log in and view the resource group bound to the current user.

SELECT CURRENT_RESOURCE_GROUP();
+--------------------------+ | CURRENT_RESOURCE_GROUP() | +--------------------------+ | rg1 | +--------------------------+ 1 row in set (0.00 sec)

Execute SET RESOURCE GROUP to set the resource group for the current session to rg2.

SET RESOURCE GROUP `rg2`; SELECT CURRENT_RESOURCE_GROUP();
+--------------------------+ | CURRENT_RESOURCE_GROUP() | +--------------------------+ | rg2 | +--------------------------+ 1 row in set (0.00 sec)

Execute SET RESOURCE GROUP to specify the current session to use the default resource group.

SET RESOURCE GROUP `default`; SELECT CURRENT_RESOURCE_GROUP();
+--------------------------+ | CURRENT_RESOURCE_GROUP() | +--------------------------+ | default | +--------------------------+ 1 row in set (0.00 sec)

MySQL compatibility

MySQL also supports SET RESOURCE GROUP. But the accepted parameters are different from that of TiDB. They are not compatible.

See also

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.