The SET_TABLEGROUP_BALANCE_WEIGHT procedure is used to set the weight of a table group of the SHARDING NONE type.
Note
This procedure is available starting from OceanBase Database V4.4.1.
Syntax
DBMS_BALANCE.SET_TABLEGROUP_BALANCE_WEIGHT(
weight INT,
tablegroup_name VARCHAR(65535)
);
Parameters
| Parameter | Description |
|---|---|
| weight | The weight of the table group. This parameter is an integer in the range [1, +∞). The larger the value, the higher the resource allocation ratio. |
| tablegroup_name | The name of the table group. |
Considerations
DBMS_BALANCE.SET_TABLEGROUP_BALANCE_WEIGHTis used to set the weight of aSHARDING NONEtable group.When
enable_database_sharding_none = true, the default weight of the table group bound to the new database is 1. OtherSHARDING NONEtable groups without specified weights have a default weight of 0 and do not participate in weight balancing.Table-level and partition-level weights in weighted table groups are invalid.
We recommend that you divide the table group weights into three levels:
- The weight of the first level = 100% * the number of
SHARDING NONEtable groups. - The weight of the second level = 50% * the number of
SHARDING NONEtable groups. - The weight of the third level = 1.
- The weight of the first level = 100% * the number of
Examples
Call the procedure in the sys tenant to set the weight of the
TG_TD_testtable group to 10 in themysqltenant.obclient> CALL DBMS_BALANCE.SET_TABLEGROUP_BALANCE_WEIGHT(10, 'TG_TD_test') TENANT = 'mysql';Call the procedure in the user tenant to set the weight of the
TG_TD_testtable group to 10 in the user tenant.obclient> CALL DBMS_BALANCE.SET_TABLEGROUP_BALANCE_WEIGHT(10, 'TG_TD_test');
References
- For more information about how to remove the weight of a
SHARDING NONEtable group, see CLEAR_TABLEGROUP_BALANCE_WEIGHT. - For more information about how to query the weight of a table group, see oceanbase.CDB_OB_DATABASES or oceanbase.DBA_OB_DATABASES.
- For more information about how to control whether automatic aggregation is enabled for user tables when a database is created, see enable_database_sharding_none.
