After setting table group weights, you can clear the original weights as needed.
Considerations
Clearing a table group's weight removes the weight from the table group. If tables within the table group have had table-level or partition-level weights set, the system will retain those weights.
Procedure
Log in to the user tenant of the cluster.
Note that you must specify the corresponding options in the following sample code based on your actual database configurations.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql001#obdemo -p***** -ARetrieve the table group weight information.
obclient(root@mysql001)[test]> SELECT TABLEGROUP_NAME, WEIGHT, TABLEGROUP_ID, OBJECT_ID FROM oceanbase.DBA_OB_OBJECT_BALANCE_WEIGHT WHERE TABLEGROUP_NAME = 'TG_DB_test';The query result is as follows:
+-----------------+--------+---------------+-----------+ | TABLEGROUP_NAME | WEIGHT | TABLEGROUP_ID | OBJECT_ID | +-----------------+--------+---------------+-----------+ | TG_DB_test | 10 | 500007 | 500007 | +-----------------+--------+---------------+-----------+ 1 row in setClear the table group weight.
To clear the weight for the
TG_DB_testtable group, use the following statement.obclient(root@mysql001)[test]> CALL DBMS_BALANCE.CLEAR_TABLEGROUP_BALANCE_WEIGHT('TG_DB_test');It is also supported for the
systenant to clear the weight for a table group specified by the user tenantmysql001, using the following statement:obclient(root@sys)[(none)]> CALL DBMS_BALANCE.CLEAR_TABLEGROUP_BALANCE_WEIGHT('TG_DB_test') TENANT = 'mysql001';After clearing the table group weight, you can check the table group weight information again.
obclient(root@mysql001)[test]> SELECT TABLEGROUP_NAME, WEIGHT, TABLEGROUP_ID, OBJECT_ID FROM oceanbase.DBA_OB_OBJECT_BALANCE_WEIGHT WHERE TABLEGROUP_NAME = 'TG_DB_test';If the query result is empty, the table group weight is successfully cleared.
What to do next
After clearing a table group's weight, the partition distribution across tables within the table group may become unbalanced. If you want to trigger partition balancing as soon as possible, you can manually trigger a partition balancing by calling the DBMS_BALANCE.TRIGGER_PARTITION_BALANCE subprogram. For more information about how to manually trigger partition balancing, see Manually trigger partition balancing.
Alternatively, you can wait for a scheduled partition balancing task to be triggered. For information about scheduled partition balancing tasks, see Configure a scheduled partition balancing task.