分布表数据分布情况验证情形总结
一、原表为随机分布表
set global gcluster_random_insert=0
# 1) gcluster_random_insert=0时,写入数据重复,insert value 数据都落在和发起集群节点相同的单机节点上
gbase> create table tba(name varchar(10)); insert into tba values ('tutu'),('tutu'),('tutu'),('tutu');
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tba';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tba | n1 | 192.168.195.101 | 100 | 780 | 100.0000% |
| vc1 | tdb | tba | n2 | 192.168.195.102 | 0 | 287 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 2) gcluster_random_insert=0时,写入数据不重复,insert value 数据都落在和发起集群节点相同的单机节点上
gbase> create table tbb(name varchar(10)); insert into tbb values ('tutu1'),('tutu2'),('tutu3'),('tutu4');
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbb';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbb | n1 | 192.168.195.101 | 104 | 784 | 100.0000% |
| vc1 | tdb | tbb | n2 | 192.168.195.102 | 0 | 287 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 3.1) gcluster_random_insert=0时,原随机分布表写入数据重复,从原随机分布表create table select新随机分布表,数据都落在和发起集群节点相同的单机节点上
gbase> create table tb1_1 select * from tba;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb1_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb1_1 | n1 | 192.168.195.101 | 100 | 780 | 100.0000% |
| vc1 | tdb | tb1_1 | n2 | 192.168.195.102 | 0 | 287 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 3.2) gcluster_random_insert=0时,原随机分布表写入数据不重复,从原随机分布表create table select新随机分布表,数据都落在和发起集群节点相同的单机节点上
gbase> create table tb1_2 select * from tbb;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb1_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb1_2 | n1 | 192.168.195.101 | 104 | 784 | 100.0000% |
| vc1 | tdb | tb1_2 | n2 | 192.168.195.102 | 0 | 287 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 4.1) gcluster_random_insert=0时,原随机分布表写入数据重复,从原随机分布表insert into select新随机分布表,数据都落在和发起集群节点相同的单机节点上
gbase> create table tb2_1 (name varchar(10)); insert into tb2_1 select * from tba;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb2_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb2_1 | n1 | 192.168.195.101 | 100 | 780 | 100.0000% |
| vc1 | tdb | tb2_1 | n2 | 192.168.195.102 | 0 | 287 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 4.2) gcluster_random_insert=0时,原随机分布表写入数据不重复,从原随机分布表insert into select新随机分布表,数据都落在和发起集群节点相同的单机节点上
gbase> create table tb2_2 (name varchar(10)); insert into tb2_2 select * from tbb;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb2_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb2_2 | n1 | 192.168.195.101 | 104 | 784 | 100.0000% |
| vc1 | tdb | tb2_2 | n2 | 192.168.195.102 | 0 | 287 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 5.1) gcluster_random_insert=0时,原随机分布表写入数据重复,从原随机分布表create table select新hash分布表,重复数据落相同的单机节点上
gbase> create table tb3_1 distributed by ('name') select * from tba;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb3_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb3_1 | n1 | 192.168.195.101 | 0 | 287 | 0.0000% |
| vc1 | tdb | tb3_1 | n2 | 192.168.195.102 | 100 | 780 | 100.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 5.2) gcluster_random_insert=0时,原随机分布表写入数据不重复,从原随机分布表create table select新hash分布表,数据随机落在任意单机节点上
gbase> create table tb3_2 distributed by ('name') select * from tbb;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb3_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb3_2 | n1 | 192.168.195.101 | 86 | 766 | 50.0000% |
| vc1 | tdb | tb3_2 | n2 | 192.168.195.102 | 86 | 766 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+set global gcluster_random_insert=1
# 1) gcluster_random_insert=1时,写入数据重复,insert value 数据随机落在任意单机节点上
gbase> create table tbc(name varchar(10)); insert into tbc values ('tutu'),('tutu'),('tutu'),('tutu');
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbc';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbc | n1 | 192.168.195.101 | 76 | 756 | 45.2381% |
| vc1 | tdb | tbc | n2 | 192.168.195.102 | 92 | 772 | 54.7619% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 2) gcluster_random_insert=1时,写入数据不重复,insert value 数据随机落在任意单机节点上
gbase> create table tbd(name varchar(10)); insert into tbd values ('tutu1'),('tutu2'),('tutu3'),('tutu4');
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbd';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbd | n1 | 192.168.195.101 | 95 | 775 | 55.2326% |
| vc1 | tdb | tbd | n2 | 192.168.195.102 | 77 | 757 | 44.7674% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 3) 原随机分布表数据倾斜
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tba';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tba | n1 | 192.168.195.101 | 100 | 780 | 100.0000% |
| vc1 | tdb | tba | n2 | 192.168.195.102 | 0 | 287 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbb';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbb | n1 | 192.168.195.101 | 104 | 784 | 100.0000% |
| vc1 | tdb | tbb | n2 | 192.168.195.102 | 0 | 287 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
# 3.1) gcluster_random_insert=1时,原随机分布表写入数据重复,原随机分布表数据倾斜,从原随机分布表create table select新随机分布表,数据都落在和发起集群节点相同的单机节点上
gbase> create table tb4_1 select * from tba;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb4_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb4_1 | n1 | 192.168.195.101 | 100 | 780 | 100.0000% |
| vc1 | tdb | tb4_1 | n2 | 192.168.195.102 | 0 | 287 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 3.2) gcluster_random_insert=1时,原随机分布表写入数据不重复,原随机分布表数据倾斜,从原随机分布表create table select新随机分布表,数据都落在和发起集群节点相同的单机节点上
gbase> create table tb4_2 select * from tbb;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb4_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb4_2 | n1 | 192.168.195.101 | 104 | 784 | 100.0000% |
| vc1 | tdb | tb4_2 | n2 | 192.168.195.102 | 0 | 287 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 3.3) gcluster_random_insert=1时,原随机分布表写入数据重复,原随机分布表数据未倾斜,从原随机分布表create table select新随机分布表,数据随机落在任意单机节点上
gbase> create table tb4_3 select * from tbc;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb4_3';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb4_3 | n1 | 192.168.195.101 | 92 | 772 | 54.7619% |
| vc1 | tdb | tb4_3 | n2 | 192.168.195.102 | 76 | 756 | 45.2381% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 3.4) gcluster_random_insert=1时,原随机分布表写入数据不重复,原随机分布表数据未倾斜,从原随机分布表create table select新随机分布表,数据随机落在任意单机节点上
gbase> create table tb4_4 select * from tbd;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb4_4';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb4_4 | n1 | 192.168.195.101 | 95 | 775 | 55.2326% |
| vc1 | tdb | tb4_4 | n2 | 192.168.195.102 | 77 | 757 | 44.7674% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
# 4.1) gcluster_random_insert=1时,原随机分布表写入数据重复,原随机分布表数据倾斜,从原随机分布表insert into select新随机分布表,数据都落在和发起集群节点相同的单机节点上
gbase> create table tb5_1 (name varchar(10)); insert into tb5_1 select * from tba;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb5_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb5_1 | n1 | 192.168.195.101 | 100 | 780 | 100.0000% |
| vc1 | tdb | tb5_1 | n2 | 192.168.195.102 | 0 | 287 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 4.2) gcluster_random_insert=1时,原随机分布表写入数据不重复,原随机分布表数据倾斜,从原随机分布表insert into select新随机分布表,数据都落在和发起集群节点相同的单机节点上
gbase> create table tb5_2 (name varchar(10)); insert into tb5_2 select * from tbb;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb5_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb5_2 | n1 | 192.168.195.101 | 104 | 784 | 100.0000% |
| vc1 | tdb | tb5_2 | n2 | 192.168.195.102 | 0 | 287 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 4.3) gcluster_random_insert=1时,原随机分布表写入数据重复,原随机分布表数据未倾斜,从原随机分布表insert into select新随机分布表,数据随机落在任意单机节点上
gbase> create table tb5_3 (name varchar(10)); insert into tb5_3 select * from tbc;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb5_3';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb5_3 | n1 | 192.168.195.101 | 92 | 772 | 54.7619% |
| vc1 | tdb | tb5_3 | n2 | 192.168.195.102 | 76 | 756 | 45.2381% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 4.4) gcluster_random_insert=1时,原随机分布表写入数据不重复,原随机分布表数据未倾斜,从原随机分布表insert into select新随机分布表,数据随机落在任意单机节点上
gbase> create table tb5_4 (name varchar(10)); insert into tb5_4 select * from tbd;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb5_4';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb5_4 | n1 | 192.168.195.101 | 95 | 775 | 55.2326% |
| vc1 | tdb | tb5_4 | n2 | 192.168.195.102 | 77 | 757 | 44.7674% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 5.1) gcluster_random_insert=1时,原随机分布表写入数据重复,原随机分布表数据倾斜,从原随机分布表create table select新hash分布表,重复数据落在相同的单机节点上
gbase> create table tb6_1 distributed by ('name') select * from tba;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb6_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb6_1 | n1 | 192.168.195.101 | 0 | 287 | 0.0000% |
| vc1 | tdb | tb6_1 | n2 | 192.168.195.102 | 100 | 780 | 100.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 5.2) gcluster_random_insert=1时,原随机分布表写入数据不重复,原随机分布表数据倾斜,从原随机分布表create table select新hash分布表,数据随机落在任意单机节点上
gbase> create table tb6_2 distributed by ('name') select * from tbb;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb6_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb6_2 | n1 | 192.168.195.101 | 86 | 766 | 50.0000% |
| vc1 | tdb | tb6_2 | n2 | 192.168.195.102 | 86 | 766 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 5.3) gcluster_random_insert=1时,原随机分布表写入数据重复,原随机分布表数据未倾斜,从原随机分布表create table select新hash分布表,重复数据落在相同的单机节点上
gbase> create table tb6_3 distributed by ('name') select * from tbc;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb6_3';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb6_3 | n1 | 192.168.195.101 | 0 | 287 | 0.0000% |
| vc1 | tdb | tb6_3 | n2 | 192.168.195.102 | 100 | 780 | 100.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 5.4) gcluster_random_insert=1时,原随机分布表写入数据不重复,原随机分布表数据未倾斜,从原随机分布表create table select新hash分布表,数据随机落在任意单机节点上
gbase> create table tb6_4 distributed by ('name') select * from tbd;
gbase> select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tb6_4';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tb6_4 | n1 | 192.168.195.101 | 86 | 766 | 50.0000% |
| vc1 | tdb | tb6_4 | n2 | 192.168.195.102 | 86 | 766 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
二、原表为hash分布表
A.原表为hash表,且数据分布均匀:
drop table if exists tba; create table tba(id int, name varchar(10)) distributed by ('id'); insert into tba values (1,'tutu'),(2,'tutu'),(3,'tutu'),(4,'tutu');
drop table if exists tbb; create table tbb(id int, name varchar(10)) distributed by ('id'); insert into tbb values (1,'tutu1'),(2,'tutu2'),(3,'tutu3'),(4,'tutu4');
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tba';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tba | n1 | 192.168.195.101 | 120 | 1176 | 50.0000% |
| vc1 | tdb | tba | n2 | 192.168.195.102 | 120 | 1176 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbb';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbb | n1 | 192.168.195.101 | 122 | 1178 | 50.0000% |
| vc1 | tdb | tbb | n2 | 192.168.195.102 | 122 | 1178 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
select * from gbase.table_distribution where dbname='tdb' and tbname in ('tba','tbb');
+------------+--------+--------+-------------+-------------+------------------+--------------------+-------------+----------------------+---------+--------------+
| index_name | dbName | tbName | isReplicate | hash_column | lmt_storage_size | table_storage_size | is_nocopies | data_distribution_id | vc_id | mirror_vc_id |
+------------+--------+--------+-------------+-------------+------------------+--------------------+-------------+----------------------+---------+--------------+
| tdb.tba | tdb | tba | NO | id | NULL | NULL | NO | 4 | vc00001 | NULL |
| tdb.tbb | tdb | tbb | NO | id | NULL | NULL | NO | 4 | vc00001 | NULL |
+------------+--------+--------+-------------+-------------+------------------+--------------------+-------------+----------------------+---------+--------------+# 1)create table select
drop table if exists tba_1; create table tba_1 select * from tba;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tba_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tba_1 | n1 | 192.168.195.101 | 120 | 1176 | 50.0000% |
| vc1 | tdb | tba_1 | n2 | 192.168.195.102 | 120 | 1176 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
drop table if exists tbb_1; create table tbb_1 select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbb_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbb_1 | n1 | 192.168.195.101 | 122 | 1178 | 50.0000% |
| vc1 | tdb | tbb_1 | n2 | 192.168.195.102 | 122 | 1178 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 2) create table distributed select
drop table if exists tba_2; create table tba_2 distributed by ('id') select * from tba;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tba_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tba_2 | n1 | 192.168.195.101 | 120 | 1176 | 50.0000% |
| vc1 | tdb | tba_2 | n2 | 192.168.195.102 | 120 | 1176 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
drop table if exists tbb_2; create table tbb_2 distributed by ('id') select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbb_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbb_2 | n1 | 192.168.195.101 | 122 | 1178 | 50.0000% |
| vc1 | tdb | tbb_2 | n2 | 192.168.195.102 | 122 | 1178 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 3) create table select union
drop table if exists tbc_1; create table tbc_1 select * from tba union select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbc_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbc_1 | n1 | 192.168.195.101 | 137 | 1193 | 50.0000% |
| vc1 | tdb | tbc_1 | n2 | 192.168.195.102 | 137 | 1193 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 4) create table distributed select union
drop table if exists tbc_2; create table tbc_2 distributed by ('id') select * from tba union select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbc_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbc_2 | n1 | 192.168.195.101 | 137 | 1193 | 50.0000% |
| vc1 | tdb | tbc_2 | n2 | 192.168.195.102 | 137 | 1193 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 5) create table nocopies select union
drop table if exists tbc_3; create table tbc_3 nocopies select * from tba union select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbc_3';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbc_3 | n1 | 192.168.195.101 | 137 | 1193 | 50.0000% |
| vc1 | tdb | tbc_3 | n2 | 192.168.195.102 | 137 | 1193 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
B.原表为hash表,且一个表数据分布不均匀:
drop table if exists tba; create table tba(id int, name varchar(10)) distributed by ('id'); insert into tba values (1,'tutu'),(1,'tutu'),(1,'tutu'),(1,'tutu');
drop table if exists tbb; create table tbb(id int, name varchar(10)) distributed by ('id'); insert into tbb values (1,'tutu1'),(2,'tutu2'),(3,'tutu3'),(4,'tutu4');
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tba';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tba | n1 | 192.168.195.101 | 100 | 1156 | 100.0000% |
| vc1 | tdb | tba | n2 | 192.168.195.102 | 0 | 422 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbb';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbb | n1 | 192.168.195.101 | 122 | 1178 | 50.0000% |
| vc1 | tdb | tbb | n2 | 192.168.195.102 | 122 | 1178 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
select * from gbase.table_distribution where dbname='tdb' and tbname in ('tba','tbb');
+------------+--------+--------+-------------+-------------+------------------+--------------------+-------------+----------------------+---------+--------------+
| index_name | dbName | tbName | isReplicate | hash_column | lmt_storage_size | table_storage_size | is_nocopies | data_distribution_id | vc_id | mirror_vc_id |
+------------+--------+--------+-------------+-------------+------------------+--------------------+-------------+----------------------+---------+--------------+
| tdb.tba | tdb | tba | NO | id | NULL | NULL | NO | 4 | vc00001 | NULL |
| tdb.tbb | tdb | tbb | NO | id | NULL | NULL | NO | 4 | vc00001 | NULL |
+------------+--------+--------+-------------+-------------+------------------+--------------------+-------------+----------------------+---------+--------------+# 1)create table select
drop table if exists tba_1; create table tba_1 select * from tba;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tba_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tba_1 | n1 | 192.168.195.101 | 100 | 1156 | 100.0000% |
| vc1 | tdb | tba_1 | n2 | 192.168.195.102 | 0 | 422 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
drop table if exists tbb_1; create table tbb_1 select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbb_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbb_1 | n1 | 192.168.195.101 | 122 | 1178 | 50.0000% |
| vc1 | tdb | tbb_1 | n2 | 192.168.195.102 | 122 | 1178 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 2)create table distributed select
drop table if exists tba_2; create table tba_2 distributed by ('id') select * from tba;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tba_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tba_2 | n1 | 192.168.195.101 | 100 | 1156 | 100.0000% |
| vc1 | tdb | tba_2 | n2 | 192.168.195.102 | 0 | 422 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
drop table if exists tbb_2; create table tbb_2 distributed by ('id') select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbb_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbb_2 | n1 | 192.168.195.101 | 122 | 1178 | 50.0000% |
| vc1 | tdb | tbb_2 | n2 | 192.168.195.102 | 122 | 1178 | 50.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 3)create table select union
drop table if exists tbc_1; create table tbc_1 select * from tba union select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbc_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbc_1 | n1 | 192.168.195.101 | 131 | 1187 | 51.7787% |
| vc1 | tdb | tbc_1 | n2 | 192.168.195.102 | 122 | 1178 | 48.2213% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 4)create table distributed select union
drop table if exists tbc_2; create table tbc_2 distributed by ('id') select * from tba union select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbc_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbc_2 | n1 | 192.168.195.101 | 131 | 1187 | 51.7787% |
| vc1 | tdb | tbc_2 | n2 | 192.168.195.102 | 122 | 1178 | 48.2213% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 5)create table nocopies select union
drop table if exists tbc_3; create table tbc_3 nocopies as select * from tba union select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbc_3';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbc_3 | n1 | 192.168.195.101 | 131 | 1187 | 51.7787% |
| vc1 | tdb | tbc_3 | n2 | 192.168.195.102 | 122 | 1178 | 48.2213% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
B.原表为hash表,且2个表数据分布都不均匀:
drop table if exists tba; create table tba(id int, name varchar(10)) distributed by ('id'); insert into tba values (1,'tutu'),(1,'tutu'),(1,'tutu'),(1,'tutu');
drop table if exists tbb; create table tbb(id int, name varchar(10)) distributed by ('id'); insert into tbb values (1,'tutu1'),(1,'tutu2'),(1,'tutu3'),(1,'tutu4');
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tba';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tba | n1 | 192.168.195.101 | 100 | 1156 | 100.0000% |
| vc1 | tdb | tba | n2 | 192.168.195.102 | 0 | 422 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbb';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbb | n1 | 192.168.195.101 | 104 | 1160 | 100.0000% |
| vc1 | tdb | tbb | n2 | 192.168.195.102 | 0 | 422 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
select * from gbase.table_distribution where dbname='tdb' and tbname in ('tba','tbb');
+------------+--------+--------+-------------+-------------+------------------+--------------------+-------------+----------------------+---------+--------------+
| index_name | dbName | tbName | isReplicate | hash_column | lmt_storage_size | table_storage_size | is_nocopies | data_distribution_id | vc_id | mirror_vc_id |
+------------+--------+--------+-------------+-------------+------------------+--------------------+-------------+----------------------+---------+--------------+
| tdb.tba | tdb | tba | NO | id | NULL | NULL | NO | 4 | vc00001 | NULL |
| tdb.tbb | tdb | tbb | NO | id | NULL | NULL | NO | 4 | vc00001 | NULL |
+------------+--------+--------+-------------+-------------+------------------+--------------------+-------------+----------------------+---------+--------------+# 1)create table select
drop table if exists tba_1; create table tba_1 select * from tba;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tba_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tba_1 | n1 | 192.168.195.101 | 100 | 1156 | 100.0000% |
| vc1 | tdb | tba_1 | n2 | 192.168.195.102 | 0 | 422 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
drop table if exists tbb_1; create table tbb_1 select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbb_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbb_1 | n1 | 192.168.195.101 | 104 | 1160 | 100.0000% |
| vc1 | tdb | tbb_1 | n2 | 192.168.195.102 | 0 | 422 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 2)create table distributed select
drop table if exists tba_2; create table tba_2 distributed by ('id') select * from tba;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tba_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tba_2 | n1 | 192.168.195.101 | 100 | 1156 | 100.0000% |
| vc1 | tdb | tba_2 | n2 | 192.168.195.102 | 0 | 422 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
drop table if exists tbb_2; create table tbb_2 distributed by ('id') select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbb_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbb_2 | n1 | 192.168.195.101 | 104 | 1160 | 100.0000% |
| vc1 | tdb | tbb_2 | n2 | 192.168.195.102 | 0 | 422 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 3)create table select union
drop table if exists tbc_1; create table tbc_1 select * from tba union select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbc_1';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbc_1 | n1 | 192.168.195.101 | 112 | 1168 | 100.0000% |
| vc1 | tdb | tbc_1 | n2 | 192.168.195.102 | 0 | 422 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 4)create table distributed select union
drop table if exists tbc_2; create table tbc_2 distributed by ('id') select * from tba union select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbc_2';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbc_2 | n1 | 192.168.195.101 | 112 | 1168 | 100.0000% |
| vc1 | tdb | tbc_2 | n2 | 192.168.195.102 | 0 | 422 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+# 5)create table nocopies select union
drop table if exists tbc_3; create table tbc_3 nocopies select * from tba union select * from tbb;
select * from information_schema.cluster_table_segments where table_schema='tdb' and table_name='tbc_3';
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| TABLE_VC | TABLE_SCHEMA | TABLE_NAME | SUFFIX | HOST | TABLE_DATA_SIZE | TABLE_STORAGE_SIZE | DATA_PERCENT |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
| vc1 | tdb | tbc_3 | n1 | 192.168.195.101 | 112 | 1168 | 100.0000% |
| vc1 | tdb | tbc_3 | n2 | 192.168.195.102 | 0 | 422 | 0.0000% |
+----------+--------------+------------+--------+-----------------+-----------------+--------------------+--------------+
评论
热门帖子
- 12025-12-01浏览数:182759
- 22023-05-09浏览数:25051
- 42023-09-25浏览数:18521
- 52020-05-11浏览数:17526