Changes the limits of a resource group.
ALTER RESOURCE GROUP <name> SET <group_attribute> <value>
where group_attribute is one of:
CONCURRENCY <integer> CPU_HARD_QUOTA_LIMIT <integer> CPUSET <tuple> MEMORY_LIMIT <integer> MEMORY_SHARED_QUOTA <integer> MEMORY_SPILL_RATIO <integer>
ALTER RESOURCE GROUP changes the limits of a resource group. Only a superuser can alter a resource group.
You can set or reset the concurrency limit of a resource group that you create for roles to control the maximum number of active concurrent statements in that group. You can also reset the memory or CPU resources of a resource group to control the amount of memory or CPU resources that all queries submitted through the group can consume on each segment host.
When you alter the CPU resource management mode or limit of a resource group, the new mode or limit is immediately applied.
When you alter a memory limit of a resource group that you create for roles, the new resource limit is immediately applied if current resource usage is less than or equal to the new value and there are no running transactions in the resource group. If the current resource usage exceeds the new memory limit value, or if there are running transactions in other resource groups that hold some of the resource, then Greenplum Database defers assigning the new limit until resource usage falls within the range of the new value.
When you increase the memory limit of a resource group that you create for external components, the new resource limit is phased in as system memory resources become available. If you decrease the memory limit of a resource group that you create for external components, the behavior is component-specific. For example, if you decrease the memory limit of a resource group that you create for a PL/Container runtime, queries in a running container may fail with an out of memory error.
You can alter one limit type in a single
ALTER RESOURCE GROUP call.
CONCURRENCYvalue limit is reached are queued. When a running transaction completes, the earliest queued transaction is run.
CONCURRENCY value must be an integer in the range [0 ..
max_connections]. The default
CONCURRENCY value for a resource group that you create for roles is 20.
You cannot set the
CONCURRENCYvalue for the
admin_groupto zero (0).
cpu_hard_quota_limits of all resource groups defined in the Greenplum Database cluster must not exceed 100.
If you alter the
cpu_hard_quota_limit of a resource group in which you previously configured a
CPUSET is deactivated, the reserved CPU cores are returned to Greenplum Database, and
CPUSET is set to -1.
Specify cores as a comma-separated list of single core numbers or core intervals. Define the coordinator host cores first, followed by segment host cores, and separate the two with a semicolon. You must enclose the full core configuration in single quotes. For example, ‘1;1,3-4’ configures core 1 for the coordinator host, and cores 1, 3, and 4 for the segment hosts.
If you alter the
CPUSET value of a resource group for which you previously configured a
cpu_hard_quota_limit is deactivated, the reserved CPU resources are returned to Greenplum Database, and
cpu_hard_quota_limit is set to -1.
You can alter
CPUSET for a resource group only after you have enabled resource group-based resource management for your Greenplum Database cluster.
MEMORY_LIMIT is 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_LIMITs of all resource groups defined in the Greenplum Database cluster must not exceed 100. If this sum is less than 100, Greenplum Database allocates any unreserved memory to a resource group global shared memory pool.
MEMORY_SHARED_QUOTAvalue is 80.
MEMORY_SPILL_RATIOvalue is 0. When
MEMORY_SPILL_RATIOis 0, Greenplum Database uses the
statement_memserver configuration parameter value to control initial query operator memory.
You cannot submit an
ALTER RESOURCE GROUP command in an explicit transaction or sub-transaction.
Change the active transaction limit for a resource group:
ALTER RESOURCE GROUP rgroup1 SET CONCURRENCY 13;
Update the CPU limit for a resource group:
ALTER RESOURCE GROUP rgroup2 SET cpu_hard_quota_limit 45;
Update the memory limit for a resource group:
ALTER RESOURCE GROUP rgroup3 SET MEMORY_LIMIT 30;
Update the memory spill ratio for a resource group:
ALTER RESOURCE GROUP rgroup4 SET MEMORY_SPILL_RATIO 25;
Reserve CPU core 1 for a resource group on the coordinator host and all segment hosts:
ALTER RESOURCE GROUP rgroup5 SET CPUSET '1;1';
ALTER RESOURCE GROUP statement is a Greenplum Database extension. This command does not exist in standard PostgreSQL.
Parent topic: SQL Commands