EDB Resource Manager v13
EDB Resource Manager is an Advanced Server feature that provides the capability to control the usage of operating system resources used by Advanced Server processes.
This capability allows you to protect the system from processes that may uncontrollably overuse and monopolize certain system resources.
The following are some key points about using EDB Resource Manager.
- The basic component of EDB Resource Manager is a resource group. A resource group is a named, global group, available to all databases in an Advanced Server instance, on which various resource usage limits can be defined. Advanced Server processes that are assigned as members of a given resource group are then controlled by EDB Resource Manager so that the aggregate resource usage of all processes in the group is kept near the limits defined on the group.
- Data definition language commands are used to create, alter, and drop resource groups. These commands can only be used by a database user with superuser privileges.
- The desired, aggregate consumption level of all processes belonging to a resource group is defined by resource type parameters. There are different resource type parameters for the different types of system resources currently supported by EDB Resource Manager.
- Multiple resource groups can be created, each with different settings for its resource type parameters, thus defining different consumption levels for each resource group.
- EDB Resource Manager throttles processes in a resource group to keep resource consumption near the limits defined by the resource type parameters. If there are multiple resource type parameters with defined settings in a resource group, the actual resource consumption may be significantly lower for certain resource types than their defined resource type parameter settings. This is because EDB Resource Manager throttles processes attempting to keep all resources with defined resource type settings within their defined limits.
- The definition of available resource groups and their resource type settings are stored in a shared global system catalog. Thus, resource groups can be utilized by all databases in a given Advanced Server instance.
- The
edb_max_resource_groups
configuration parameter sets the maximum number of resource groups that can be active simultaneously with running processes. The default setting is 16 resource groups. Changes to this parameter take effect on database server restart. - Use the
SET edb_resource_group TO group_name
command to assign the current process to a specified resource group. Use theRESET edb_resource_group
command orSET edb_resource_group
TO
DEFAULT
to remove the current process from a resource group. - A default resource group can be assigned to a role using the
ALTER ROLE ... SET
command, or to a database by theALTER DATABASE ... SET
command. The entire database server instance can be assigned a default resource group by setting the parameter in thepostgresql.conf
file. - In order to include resource groups in a backup file of the database server instance, use the
pg_dumpall
backup utility with default settings (That is, do not specify any of the--globals-only
,--roles-only
, or--tablespaces-only
options.)
Creating and Managing Resource Groups
The data definition language commands described in this section provide for the creation and management of resource groups.
CREATE RESOURCE GROUP
Use the CREATE RESOURCE GROUP
command to create a new resource group.
Description
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.
Parameters
group_name
The name of the resource group.
Example
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.
ALTER RESOURCE GROUP
Use the ALTER RESOURCE GROUP
command to change the attributes of an existing resource group. The command syntax comes in three forms.
The first form renames the resource group:
The second form assigns a resource type to the resource group:
The third form resets the assignment of a resource type to its default within the group:
Description
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.
Parameters
group_name
The name of the resource group to be altered.
new_name
The new name to be assigned to the resource group.
resource_type
The resource type parameter specifying the type of resource to which a usage value is to be set.
value | DEFAULT
When 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.
Example
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.
DROP RESOURCE GROUP
Use the DROP RESOURCE GROUP
command to remove a resource group.