该语句用来执行以下操作:
对一个表组增加多张表。
修改表组的分区规则。
修改表组的 Locality 和 Primary Zone。
对一个表组增加多张表。
ALTER TABLEGROUP tablegroupname ADD [TABLE] tblname [, tblname…]
修改表组的分区规则。
ALTER TABLEGROUP tablegroupname alter_tg_partition_option
alter_tg_partition_option:
DROP PARTITION '(' name_list ')'
| ADD PARTITION opt_range_partition_list
| modify_tg_partition_info
修改表组的 Locality 和 Primary Zone。
ALTER TABLEGROUP tablegroupname alter_tablegroup_actions
alter_tablegroup_actions:
alter_tablegroup_action
| alter_tablegroup_action, alter_tablegroup_action
alter_tablegroup_action:
SET LOCALITY [=] locality_name
|SET PRIMARY_ZONE [=] primary_zone_name
参数 | 描述 |
---|---|
tablegroupname | 指定表组。 |
tblname | 表名。对一个表组增加多张表时,表与表之间以逗号(‘,’)分隔。 当添加多个表时,允许表名重复。如果待添加的表已经属于 |
modify_tg_partition_info | 修改表组的分区规则。 |
LOCALITY locality_name | 指定表组的 Locality。 |
PRIMARY_ZONE primary_zone_name | 指定表组的主 Zone。 |
创建表组tgh
,并将表组的 Locality
修改为 F@z1
,并创建两张关系表ttgh1
和ttgh2
。
obclient>CREATE TABLEGROUP tgh LOCALITY='F,R{ALL_SERVER}@z1' PARTITION BY HASH PARTITIONS 10;
Query OK, 0 rows affected (0.09 sec)
obclient>SELECT LOCALITY FROM sys.all_virtual_tablegroup_agent WHERE tablegroup_name ='TGH';
+------------------------------------+
| LOCALITY |
+------------------------------------+
| FULL{1},READONLY{ALL_SERVER}@1 |
+------------------------------------+
1 row in set (0.01 sec)
obclient>ALTER TABLEGROUP tgh SET LOCALITY ='F@z1';
Query OK, 0 rows affected (0.09 sec)
obclient>SELECT LOCALITY FROM sys.all_virtual_tablegroup_agent WHERE tablegroup_name ='TGH';
+------------+
| LOCALITY |
+------------+
| FULL{1}@z1 |
+------------+
1 row in set (0.05 sec)
obclient>SELECT LOCALITY FROM sys.all_virtual_tablegroup_agent WHERE tablegroup_id=(SELECT tablegroup_id FROM sys.all_virtual_tablegroup_agent WHERE tablegroup_name ='TGH');
+---------------+
| LOCALITY |
+---------------+
| FULL{1}@z1 |
+---------------+
1 row in set (0.00 sec)
obclient>CREATE TABLE ttgh1(c1 INT, c2 INT) TABLEGROUP = tgh LOCALITY='F@z1' PARTITION BY HASH(c1) PARTITIONS 10;
Query OK, 0 rows affected (0.55 sec)
obclient>CREATE TABLE ttgh2(c1 INT, c2 INT) TABLEGROUP = tgh LOCALITY='F@z1' PARTITION BY HASH(c1) PARTITIONS 10;
Query OK, 0 rows affected (0.39 sec)
备案信息: 粤ICP备15087711号-2
Copyright © 2008-2024 啊嘎哇在线工具箱 All Rights.
本站所有资料来源于网络,版权归原作者所有,仅作学习交流使用,如不慎侵犯了您的权利,请联系我们。