The SET_CONSUMER_GROUP_MAPPING procedure adds, deletes, or modifies 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 does not support this feature.
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 add or modify. In the current version, only the USER (database username), COLUMN, and FUNCTION attributes are supported. OceanBase Database performs background tasks such as major compactions, backups, and data completion. 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 to limit their resources to the corresponding resource groups. |
| value | The attribute value to match, including absolute mappings and regular expressions. |
| consumer_group | The name of the resource group to map to. 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 consumer group is created. If a mapping exists for the specified attribute and value, the consumer 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 | Mini merge and DDL KV merge tasks |
| FUNCTION | COMPACTION_MID | Minor merge tasks |
| FUNCTION | COMPACTION_LOW | Major merge tasks |
| FUNCTION | HA_HIGH | Replication, rebuild, and restore tasks |
| FUNCTION | HA_MID | Migration tasks |
| FUNCTION | HA_LOW | Backup and backup cleanup tasks |
| FUNCTION | DDL | Unique index validation, column deletion, and data completion operations |
| FUNCTION | DDL_HIGH | DDL MemTable dump operations |
| FUNCTION | CLOG_HIGH | clog log commit tasks |
| FUNCTION | CLOG_MID | Tasks such as reading local disks for log archiving |
| FUNCTION | CLOG_LOW | Physical standby database and CDC read tasks |
| FUNCTION | OPT_STATS | Statistics collection tasks |
| FUNCTION | GC_MACRO_BLOCK | Macro block recycling and reuse tasks |
| FUNCTION | SQL_AUDIT | SQL audit log persistence |
| FUNCTION | IMPORT | Import tasks |
| FUNCTION | MVIEW | Incremental refresh of materialized views and MLOG purge operations. |
| FUNCTION | REPLAY_HIGH | Log replay |
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
