CREATE RESOURCE GROUP

    where group_attribute is:

    1. MEMORY_LIMIT=<integer>
    2. [ MEMORY_SHARED_QUOTA=<integer> ]
    3. [ MEMORY_SPILL_RATIO=<integer> ]
    4. [ MEMORY_AUDITOR= {vmtracker | cgroup} ]

    Description

    Creates a new resource group for Greenplum Database resource management. You can create resource groups to manage resources for roles or to manage the resources of a Greenplum Database external component such as PL/Container.

    A resource group that you create to manage a user role identifies concurrent transaction, memory, and CPU limits for the role when resource groups are enabled. You may assign such resource groups to one or more roles.

    A resource group that you create to manage the resources of a Greenplum Database external component such as PL/Container identifies the memory and CPU limits for the component when resource groups are enabled. These resource groups use cgroups for both CPU and memory management. Assignment of resource groups to external components is component-specific. For example, you assign a PL/Container resource group when you configure a PL/Container runtime. You cannot assign a resource group that you create for external components to a role, nor can you assign a resource group that you create for roles to an external component.

    You must have SUPERUSER privileges to create a resource group. The maximum number of resource groups allowed in your Greenplum Database cluster is 100.

    Greenplum Database pre-defines two default resource groups: admin_group and default_group. These group names, as well as the group name none, are reserved.

    To set appropriate limits for resource groups, the Greenplum Database administrator must be familiar with the queries typically executed on the system, as well as the users/roles executing those queries and the external components they may be using, such as PL/Containers.

    After creating a resource group for a role, assign the group to one or more roles using the ALTER ROLE or commands.

    After you create a resource group to manage the CPU and memory resources of an external component, configure the external component to use the resource group. For example, configure the PL/Container runtime resource_group_id.

    name

    The name of the resource group.

    CONCURRENCY integer

    The maximum number of concurrent transactions, including active and idle transactions, that are permitted for this resource group. The CONCURRENCY value must be an integer in the range [0 .. max_connections]. The default CONCURRENCY value for resource groups defined for roles is 20.

    Note: You cannot set the CONCURRENCY value for the admin_group to zero (0).

    CPU_RATE_LIMIT integer

    CPUSET tuple

    Required. You must specify only one of CPU_RATE_LIMIT or CPUSET when you create a resource group.

    CPU_RATE_LIMIT is the percentage of CPU resources to allocate to this resource group. The minimum CPU percentage you can specify for a resource group is 1. The maximum is 100. The sum of the CPU_RATE_LIMIT values specified for all resource groups defined in the Greenplum Database cluster must be less than or equal to 100.

    CPUSET identifies the CPU cores to reserve for this resource group. The CPU cores that you specify in tuple must be available in the system and cannot overlap with any CPU cores that you specify for other resource groups.

    tuple is a comma-separated list of single core numbers or core number intervals. You must enclose tuple in single quotes, for example, ‘1,3-4’.

    Note: You can configure CPUSET for a resource group only after you have enabled resource group-based resource management for your Greenplum Database cluster.

    MEMORY_LIMIT integer

    Required. The total percentage of Greenplum Database memory resources to reserve for this resource group. The minimum memory percentage you can specify for a resource group is 0. The maximum is 100.

    When you specify a MEMORY_LIMIT of 0, Greenplum Database reserves no memory for the resource group, but uses global shared memory to fulfill all memory requests in the group. If MEMORY_LIMIT is 0, MEMORY_SPILL_RATIO must also be 0.

    The sum of the MEMORY_LIMIT values specified for all resource groups defined in the Greenplum Database cluster must be less than or equal to 100.

    MEMORY_SHARED_QUOTA integer

    MEMORY_SPILL_RATIO integer

    The memory usage threshold for memory-intensive operators in a transaction. When this threshold is reached, a transaction spills to disk. You can specify an integer percentage value from 0 to 100 inclusive. The default MEMORY_SPILL_RATIO value is 20. When MEMORY_SPILL_RATIO is 0, Greenplum Database uses the server configuration parameter value to control initial query operator memory.

    MEMORY_AUDITOR {vmtracker | cgroup}

    The memory auditor for the resource group. Greenplum Database employs virtual memory tracking for role resources and cgroup memory tracking for resources used by external components. The default MEMORY_AUDITOR is vmtracker. When you create a resource group with vmtracker memory auditing, Greenplum Database tracks that resource group’s memory internally.

    When you create a resource group specifying the cgroup MEMORY_AUDITOR, Greenplum Database defers the accounting of memory used by that resource group to cgroups. CONCURRENCY must be zero (0) for a resource group that you create for external components such as PL/Container. You cannot assign a resource group that you create for external components to a Greenplum Database role.

    Notes

    You cannot submit a CREATE RESOURCE GROUP command in an explicit transaction or sub-transaction.

    Use the gp_toolkit.gp_resgroup_config system view to display the limit settings of all resource groups:

    Create a resource group with CPU and memory limit percentages of 35:

    1. CREATE RESOURCE GROUP rgroup1 WITH (CPU_RATE_LIMIT=35, MEMORY_LIMIT=35);

    Create a resource group with a concurrent transaction limit of 20, a memory limit of 15, and a CPU limit of 25:

    Create a resource group to manage PL/Container resources specifying a memory limit of 10, and a CPU limit of 10:

    1. CONCURRENCY=0, MEMORY_AUDITOR=cgroup);

    Create a resource group with a memory limit percentage of 11 to which you assign CPU cores 1 to 3:

    Compatibility

    is a Greenplum Database extension. There is no provision for resource groups or resource management in the SQL standard.

    ALTER ROLE, , ALTER RESOURCE GROUP,