SET RESOURCE GROUPgroup_name
[FORthread_id
[,thread_id
] ...]
SET RESOURCE GROUP
is used for resource group management (see Section 5.1.16, “Resource Groups”). 用于资源组管理(请参阅第5.1.16节,“资源组”)。This statement assigns threads to a resource group. 此语句将线程分配给资源组。It requires the 它需要RESOURCE_GROUP_ADMIN
or RESOURCE_GROUP_USER
privilege.RESOURCE_GROUP_ADMIN
或RESOURCE_GROUP_USER
权限。
group_name
identifies which resource group to be assigned. group_name
标识要分配的资源组。Any 任何thread_id
values indicate threads to assign to the group. thread_id
值都表示要分配给组的线程。Thread IDs can be determined from the Performance Schema 线程ID可以从执行架构threads
table. threads
表中确定。If the resource group or any named thread ID does not exist, an error occurs.如果资源组或任何命名线程ID不存在,则会发生错误。
With no 如果没有FOR
clause, the statement assigns the current thread for the session to the resource group.FOR
子句,该语句将会话的当前线程分配给资源组。
With a 如果有一个命名线程ID的FOR
clause that names thread IDs, the statement assigns those threads to the resource group.FOR
子句,该语句将这些线程分配给资源组。
For attempts to assign a system thread to a user resource group or a user thread to a system resource group, a warning occurs.如果试图将系统线程分配给用户资源组或将用户线程分配给系统资源组,则会出现警告。
Examples:例如:
Assign the current session thread to a group:将当前会话线程分配给组:
SET RESOURCE GROUP rg1;
Assign the named threads to a group:将命名线程分配给组:
SET RESOURCE GROUP rg2 FOR 14, 78, 4;
Resource group management is local to the server on which it occurs. 资源组管理是发生在其上的服务器的本地管理。SET RESOURCE GROUP
statements are not written to the binary log and are not replicated.语句不会写入二进制日志,也不会被复制。
An alternative to 另一种设置资源组的方法是SET RESOURCE GROUP
is the RESOURCE_GROUP
optimizer hint, which assigns individual statements to a resource group. RESOURCE_GROUP
优化器提示,它将单个语句分配给资源组。See Section 8.9.3, “Optimizer Hints”.请参阅第8.9.3节,“优化器提示”。