13.7.2.2 CREATE RESOURCE GROUP Statement语句

CREATE RESOURCE GROUP group_name
    TYPE = {SYSTEM|USER}
    [VCPU [=] vcpu_spec [, vcpu_spec] ...]
    [THREAD_PRIORITY [=] N]
    [ENABLE|DISABLE]
vcpu_spec: {N | M - N}

CREATE RESOURCE GROUP is used for resource group management (see Section 5.1.16, “Resource Groups”). 用于资源组管理(请参阅第5.1.16节,“资源组”)。This statement creates a new resource group and assigns its initial attribute values. 此语句创建一个新的资源组并分配其初始属性值。It requires the RESOURCE_GROUP_ADMIN privilege.它需要RESOURCE_GROUP_ADMIN权限。

group_name identifies which resource group to create. group_name标识要创建的资源组。If the group already exists, an error occurs.如果该组已存在,则会发生错误。

The TYPE attribute is required. TYPE属性是必需的。It should be SYSTEM for a system resource group, USER for a user resource group. 它应该是系统资源组的SYSTEM,用户资源组的USERThe group type affects permitted THREAD_PRIORITY values, as described later.如下文所述,组类型会影响允许的THREAD_PRIORITY值。

The VCPU attribute indicates the CPU affinity; that is, the set of virtual CPUs the group can use:VCPU属性表示CPU相关性;也就是说,该组可以使用的虚拟CPU集:

Example VCPU specifiers (these are all equivalent):VCPU说明符示例(这些都是等效的):

VCPU = 0,1,2,3,9,10
VCPU = 0-3,9-10
VCPU = 9,10,0-3
VCPU = 0,10,1,9,3,2

The THREAD_PRIORITY attribute indicates the priority for threads assigned to the group:THREAD_PRIORITY属性表示分配给组的线程的优先级:

ENABLE and DISABLE specify that the resource group is initially enabled or disabled. ENABLEDISABLE指定资源组最初处于启用或禁用状态。If neither is specified, the group is enabled by default. 如果两者都未指定,则默认情况下该组处于启用状态。A disabled group cannot have threads assigned to it.禁用的组不能分配线程。

Examples:

Resource group management is local to the server on which it occurs. 资源组管理是发生在其上的服务器的本地管理。CREATE RESOURCE GROUP statements are not written to the binary log and are not replicated.CREATE RESOURCE GROUP语句不会写入二进制日志,也不会被复制。