# Using Recourse Control
```
~!@-- Create resource groups@!~
CREATE RESOURCE GROUP IF NOT EXISTS rg1 RU_PER_SEC = 500 PRIORITY = HIGH BURSTABLE;

~!@-- Bind users to a resource group@!~
CREATE USER 'usr1'@'%' IDENTIFIED BY '123' RESOURCE GROUP rg1;
ALTER USER usr1 RESOURCE GROUP rg2;

~!@-- Bind the current session to a resource group@!~
SET RESOURCE GROUP rg1;

~!@-- Bind the current statement to a resource group@!~
SELECT /*+ RESOURCE_GROUP(rg1) */ * FROM t limit 10;
```
-----------------------------------------------------------------
Statement 1: create a resource group rg1. The resource limit is 500 RUs per second and allows applications in this resource group to overrun resources.

Statement 2: Creates a user usr1 and binds the user to the resource group rg1. Then, ALTER USER is used to bind the user usr1 to the resource group rg2.

Statement 3: By binding a session to a resource group, the resource usage of the corresponding session is limited by the specified usage (RU).

Statement 4: By adding the RESOURCE_GROUP(resource_group_name) hint to a SQL statement, you can specify the resource group to which the statement is bound. This hint supports SELECT, INSERT, UPDATE, and DELETE statements.

When you bind a user to a resource group by using `CREATE USER` or `ALTER USER`, it will not take effect for the user's existing sessions, but only for the user's new sessions.

