The SET_CONSUMER_GROUP_MAPPING procedure is used to add, delete, or modify entries that map sessions to resource groups based on session login and runtime attributes.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only MySQL mode.
Syntax
DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING(
attribute IN VARCHAR2,
value IN VARCHAR2,
consumer_group IN VARCHAR2 DEFAULT NULL);
Parameters
| Parameter | Description |
|---|---|
| attribute | The mapping attribute to be added or modified. In the current version, only the USER (the username of the database), COLUMN, and FUNCTION attributes are supported. OceanBase Database performs tasks such as major compactions, backups, and data completion in the background. These tasks are not user-initiated and may consume CPU and I/O resources of other users and tasks. Therefore, you can specify FUNCTION mappings for different background tasks in OceanBase Database. The resources of background tasks are limited to their corresponding resource groups. |
| value | The attribute value to be matched. This can be an absolute mapping or a regular expression. |
| consumer_group | The name of the resource group to which the mapping is applied. If this parameter is NULL, the mapping is deleted. |
Considerations
If no mapping exists for the specified attribute and value, a mapping to the specified resource group is created. If a mapping already exists for the specified attribute and value, the resource group is updated to the specified one. If the consumer_group parameter is NULL, any mapping for the specified attribute and value is deleted.
The following table lists the predefined FUNCTION resource group mapping rules in OceanBase Database. You can use the DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING procedure to modify or delete these mapping rules.
| Attribute | Value | Description |
|---|---|---|
| FUNCTION | COMPACTION_HIGH | Corresponds to MINI_MERGE and DDL KV merge tasks. |
| FUNCTION | COMPACTION_MID | Corresponds to MINOR_MERGE tasks. |
| FUNCTION | COMPACTION_LOW | Corresponds to MAJOR_MERGE tasks. |
| FUNCTION | HA_HIGH | Corresponds to replication, rebuild, and restore tasks. |
| FUNCTION | HA_MID | Corresponds to migration tasks. |
| FUNCTION | HA_LOW | Corresponds to backup and backup cleanup tasks. |
| FUNCTION | DDL | Corresponds to unique index validation and column deletion and data filling operations. |
| FUNCTION | DDL_HIGH | Corresponds to DDL MemTable dump operations. |
| FUNCTION | CLOG_HIGH | Corresponds to clog log commit tasks. |
| FUNCTION | OPT_STATS | Corresponds to statistics collection tasks. |
| FUNCTION | MVIEW | Corresponds to incremental refresh of materialized views and I/O and CPU resource usage for MLOG purge. |
Examples
obclient> CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING(
attribute => 'COLUMN' ,
value => 't2.c3 = 3 for user1',
consumer_group => 'group1');
Query OK, 0 rows affected