13.7.2.4 SET RESOURCE GROUP Statement语句

SET RESOURCE GROUP group_name
    [FOR thread_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_ADMINRESOURCE_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 threads table. 线程ID可以从执行架构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 FOR clause that names thread IDs, the statement assigns those threads to the resource group.如果有一个命名线程ID的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:例如:

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节,“优化器提示”