The SET_TABLEGROUP_BALANCE_WEIGHT subprogram is used to set the weight of a table group of the SHARDING NONE type.
Syntax
DBMS_BALANCE.SET_TABLEGROUP_BALANCE_WEIGHT(
weight INT,
tablegroup_name VARCHAR(65535)
);
Parameters
Parameter |
Description |
|---|---|
| weight | Table group weight value (integer), with a range of [1, +∞). A higher value indicates a higher proportion of resources allocated. |
| tablegroup_name | Table group name. |
Usage instructions
The DBMS_BALANCE.SET_TABLEGROUP_BALANCE_WEIGHT procedure is used to set the weight of a table group with the SHARDING NONE attribute.
When
enable_database_sharding_none = true, the default bound table group created together with a newly created database has a weight of 1. OtherSHARDING NONEtable groups that have not had their weights set have a default weight of 0 and do not participate in load balancing.In a table group with weights, table-level and partition-level weights within the table group are invalid.
We recommend dividing table groups into at most three tiers:
- Weight = 100% * Total number of
SHARDING NONEtable groups. - Weight in the middle = 50% * Total number of
SHARDING NONEtable groups. - Small weight = 1.
- Weight = 100% * Total number of
Examples
Call in the sys tenant to set the weight of table group
TG_TD_testunder tenantmysqlto 10.obclient> CALL DBMS_BALANCE.SET_TABLEGROUP_BALANCE_WEIGHT(10, 'TG_TD_test') TENANT = 'mysql';When called by a user tenant, sets the weight of the table group
TG_TD_testunder this tenant to 10.obclient> CALL DBMS_BALANCE.SET_TABLEGROUP_BALANCE_WEIGHT(10, 'TG_TD_test');
References
- For information about dropping the weight of a table group of the
SHARDING NONEtype, see CLEAR_TABLEGROUP_BALANCE_WEIGHT. - For information about querying the weights of each table group, see oceanbase.CDB_OB_DATABASES or oceanbase.DBA_OB_DATABASES.
- For information about enabling automatic aggregation for user tables when creating a database, see enable_database_sharding_none.