The data definition language commands described in this section provide for the creation and management of resource groups.5.1.1 CREATE RESOURCE GROUPUse the CREATE RESOURCE GROUP command to create a new resource group.CREATE RESOURCE GROUP group_name;The CREATE RESOURCE GROUP command creates a resource group with the specified name. Resource limits can then be defined on the group with the ALTER RESOURCE GROUP command. The resource group is accessible from all databases in the Advanced Server instance.To use the CREATE RESOURCE GROUP command you must have superuser privileges.The following example results in the creation of three resource groups named resgrp_a, resgrp_b, and resgrp_c.The following query shows the entries for the resource groups in the edb_resource_group catalog.5.1.2 ALTER RESOURCE GROUPUse the ALTER RESOURCE GROUP command to change the attributes of an existing resource group. The command syntax comes in three forms.ALTER RESOURCE GROUP group_name RENAME TO new_name;ALTER RESOURCE GROUP group_name SETALTER RESOURCE GROUP group_name RESET resource_type;The ALTER RESOURCE GROUP command changes certain attributes of an existing resource group.The first form with the RENAME TO clause assigns a new name to an existing resource group.The second form with the SET resource_type TO clause either assigns the specified literal value to a resource type, or resets the resource type when DEFAULT is specified. Resetting or setting a resource type to DEFAULT means that the resource group has no defined limit on that resource type.The third form with the RESET resource_type clause resets the resource type for the group as described previously.To use the ALTER RESOURCE GROUP command you must have superuser privileges.value | DEFAULTWhen value is specified, the literal value to be assigned to resource_type. When DEFAULT is specified, the assignment of resource_type is reset for the resource group.The following are examples of the ALTER RESOURCE GROUP command.The following query shows the results of the ALTER RESOURCE GROUP commands to the entries in the edb_resource_group catalog.5.1.3 DROP RESOURCE GROUPUse the DROP RESOURCE GROUP command to remove a resource group.DROP RESOURCE GROUP [ IF EXISTS ] group_name;The DROP RESOURCE GROUP command removes a resource group with the specified name.To use the DROP RESOURCE GROUP command you must have superuser privileges.Use the SET edb_resource_group TO group_name command to assign the current process to a specified resource group as shown by the following.The resource type settings of the group immediately take effect on the current process. If the command is used to change the resource group assigned to the current process, the resource type settings of the newly assigned group immediately take effect.Processes can be included by default in a resource group by assigning a default resource group to roles, databases, or an entire database server instance.A default resource group can be assigned to a role using the ALTER ROLE ... SET command. For more information about the ALTER ROLE command, please refer to the PostgreSQL core documentation available at:A default resource group can be assigned to a database by the ALTER DATABASE ... SET command. For more information about the ALTER DATABASE command, please refer to the PostgreSQL core documentation available at:The entire database server instance can be assigned a default resource group by setting the edb_resource_group configuration parameter in the postgresql.conf file as shown by the following.A change to edb_resource_group in the postgresql.conf file requires a configuration file reload before it takes effect on the database server instance.Set edb_resource_group to DEFAULT or use RESET edb_resource_group to remove the current process from a resource group as shown by the following.For removing a default resource group from a role, use the ALTER ROLE ... RESET form of the ALTER ROLE command.For removing a default resource group from a database, use the ALTER DATABASE ... RESET form of the ALTER DATABASE command.For removing a default resource group from the database server instance, set the edb_resource_group configuration parameter to an empty string in the postgresql.conf file and reload the configuration file.After resource groups have been created, the number of processes actively using these resource groups can be obtained from the view edb_all_resource_groups.The columns in edb_all_resource_groups are the following:
• group_name. Name of the resource group.
• active_processes. Number of active processes in the resource group.
• cpu_rate_limit. The value of the CPU rate limit resource type assigned to the resource group.
• per_process_cpu_rate_limit. The CPU rate limit applicable to an individual, active process in the resource group.
• dirty_rate_limit. The value of the dirty rate limit resource type assigned to the resource group.
• per_process_dirty_rate_limit. The dirty rate limit applicable to an individual, active process in the resource group.Note: Columns per_process_cpu_rate_limit and per_process_dirty_rate_limit do not show the actual resource consumption used by the processes, but indicate how EDB Resource Manager sets the resource limit for an individual process based upon the number of active processes in the resource group.The following shows edb_all_resource_groups when resource group resgrp_a contains no active processes, resource group resgrp_b contains two active processes, and resource group resgrp_c contains one active process.The CPU rate limit and dirty rate limit settings that are assigned to these resource groups are as follows.In the edb_all_resource_groups view, note that the per_process_cpu_rate_limit and per_process_dirty_rate_limit values are roughly the corresponding CPU rate limit and dirty rate limit divided by the number of active processes.