ALTER RESOURCE GROUP
Changes the limits of a resource group.
Synopsis
ALTER RESOURCE GROUP <name> SET <group_attribute> <value>
where group_attribute is one of:
CONCURRENCY <integer>
CPU_RATE_LIMIT <integer>
CPUSET <master_cores>;<segment_cores>
MEMORY_LIMIT <integer>
MEMORY_SHARED_QUOTA <integer>
MEMORY_SPILL_RATIO <integer>
Description
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 Greengage DB 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-mbemory error.
You can alter one limit type in a single ALTER RESOURCE GROUP call.
Parameters
| Parameter | Description |
|---|---|
name |
The name of the resource group to alter |
CONCURRENCY <integer> |
The maximum number of concurrent transactions, including active and idle transactions, that are permitted for resource groups that you assign to roles.
Any transactions submitted after the |
CPU_RATE_LIMIT <integer> |
The percentage of CPU resources to allocate to this resource group.
The minimum CPU percentage for a resource group is |
CPUSET <master_cores>;<segment_cores> |
The CPU cores to reserve for this resource group on the master host and segment hosts.
The CPU cores that you specify in must be available in the system and cannot overlap with any CPU cores that you specify for other resource groups.
Specify cores as a comma-separated list of single core numbers or core intervals.
Define the master 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, |
MEMORY_LIMIT <integer> |
The percentage of Greengage DB memory resources to reserve for this resource group.
The minimum memory percentage for a resource group is |
MEMORY_SHARED_QUOTA <integer> |
The percentage of memory resources to share among transactions in the resource group.
The minimum memory shared quota percentage for a resource group is |
MEMORY_SPILL_RATIO <integer> |
The memory usage threshold for memory-intensive operators in a transaction.
You can specify an integer percentage value from |
Notes
Use CREATE ROLE or ALTER ROLE to assign a specific resource group to a role (user).
You cannot submit an ALTER RESOURCE GROUP command in an explicit transaction or sub-transaction.
Examples
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_RATE_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 master host and all segment hosts:
ALTER RESOURCE GROUP rgroup5 SET CPUSET '1;1';
Compatibility
The ALTER RESOURCE GROUP statement is a Greengage DB extension.
This command does not exist in standard PostgreSQL.