Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
64cdd47c
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
64cdd47c
编写于
11月 22, 2018
作者:
P
Pengzhou Tang
提交者:
Tang Pengzhou
11月 23, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update test with new syntax
上级
cfe3f386
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
173 addition
and
267 deletion
+173
-267
src/test/regress/expected/reshuffle.out
src/test/regress/expected/reshuffle.out
+33
-59
src/test/regress/expected/reshuffle_ao.out
src/test/regress/expected/reshuffle_ao.out
+29
-54
src/test/regress/expected/reshuffle_aoco.out
src/test/regress/expected/reshuffle_aoco.out
+29
-54
src/test/regress/sql/reshuffle.sql
src/test/regress/sql/reshuffle.sql
+30
-36
src/test/regress/sql/reshuffle_ao.sql
src/test/regress/sql/reshuffle_ao.sql
+26
-32
src/test/regress/sql/reshuffle_aoco.sql
src/test/regress/sql/reshuffle_aoco.sql
+26
-32
未找到文件。
src/test/regress/expected/reshuffle.out
浏览文件 @
64cdd47c
...
...
@@ -25,7 +25,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
(2 rows)
begin;
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -42,7 +42,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
0 | 49
(2 rows)
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -75,7 +75,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
(1 row)
begin;
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -91,7 +91,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
0 | 100
(1 row)
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -132,7 +132,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
(2 rows)
begin;
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -149,7 +149,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
0 | 4
(2 rows)
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -183,7 +183,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
(1 row)
begin;
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -199,7 +199,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
0 | 100
(1 row)
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -238,7 +238,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -264,7 +264,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
f
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -307,7 +307,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -333,7 +333,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
f
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -377,7 +377,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -403,7 +403,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
f
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -439,7 +439,7 @@ Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -455,7 +455,7 @@ Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
0 | 100
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -488,7 +488,7 @@ Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -504,7 +504,7 @@ Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
0 | 100
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -557,7 +557,7 @@ FOR EACH STATEMENT EXECUTE PROCEDURE trigger_func('before_stmt');
update table_with_update_trigger set a = a + 1;
ERROR: UPDATE on distributed key column not allowed on relation with update triggers
-- reshuffle should success and not hiting any triggers.
Alter table table_with_update_trigger
set with (reshuffle)
;
Alter table table_with_update_trigger
expand table
;
select gp_segment_id, count(*) from table_with_update_trigger group by 1 order by 1;
gp_segment_id | count
---------------+-------
...
...
@@ -630,8 +630,7 @@ select gp_segment_id, * from mix_base_tbl order by 2, 1;
-- reshuffle the parent table, both parent and child table will be rebalanced to all
-- segments
Alter table mix_base_tbl set with (reshuffle);
NOTICE: Do not need to reshuffle public.mix_child_a
Alter table mix_base_tbl expand table;
select gp_segment_id, * from mix_base_tbl order by 2, 1;
gp_segment_id | a | b
---------------+----+----
...
...
@@ -710,7 +709,7 @@ Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
(2 rows)
begin;
Alter table part_t1
set with (reshuffle)
;
Alter table part_t1
expand table
;
Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -727,7 +726,7 @@ Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
0 | 49
(2 rows)
Alter table part_t1
set with (reshuffle)
;
Alter table part_t1
expand table
;
Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -812,7 +811,7 @@ Select count(*) > 0 from part_t1 where gp_segment_id=2;
(1 row)
begin;
Alter table part_t1
set with (reshuffle)
;
Alter table part_t1
expand table
;
Select count(*) from part_t1;
count
-------
...
...
@@ -838,7 +837,7 @@ Select count(*) > 0 from part_t1 where gp_segment_id=2;
f
(1 row)
Alter table part_t1
set with (reshuffle)
;
Alter table part_t1
expand table
;
Select count(*) from part_t1;
count
-------
...
...
@@ -858,7 +857,7 @@ select numsegments from gp_distribution_policy where localoid='part_t1'::regclas
(1 row)
drop table part_t1;
-- only reshuffle leaf partitions
-- only reshuffle leaf partitions
, not allowed now
select gp_debug_set_create_table_default_numsegments(2);
gp_debug_set_create_table_default_numsegments
-----------------------------------------------
...
...
@@ -926,49 +925,24 @@ select gp_segment_id, * from part_t1_1_prt_other_b_2_prt_2_3_prt_others_d;
0 | 89 | 2 | 1 | 4 | 0
(7 rows)
begin;
alter table part_t1_1_prt_other_b_2_prt_2_3_prt_others_d set with (reshuffle);
select gp_segment_id, * from part_t1_1_prt_other_b_2_prt_2_3_prt_others_d;
gp_segment_id | a | b | c | d | e
---------------+----+---+---+---+---
2 | 65 | 2 | 1 | 0 | 0
2 | 69 | 0 | 1 | 4 | 0
0 | 29 | 2 | 1 | 4 | 0
0 | 89 | 2 | 1 | 4 | 0
1 | 5 | 2 | 1 | 0 | 1
1 | 9 | 0 | 1 | 4 | 1
1 | 45 | 0 | 1 | 0 | 1
(7 rows)
abort;
alter table part_t1_1_prt_other_b_2_prt_2_3_prt_others_d expand table;
ERROR: cannot expand leaf or interior partition "part_t1_1_prt_other_b_2_prt_2_3_prt_others_d"
DETAIL: root/leaf/interior partitions need to have same numsegments
HINT: use "ALTER TABLE part_t1 EXPAND TABLE" instead
select gp_segment_id, * from part_t1_1_prt_other_b_2_prt_2_3_prt_others_d;
gp_segment_id | a | b | c | d | e
---------------+----+---+---+---+---
1 | 5 | 2 | 1 | 0 | 1
1 | 9 | 0 | 1 | 4 | 1
1 | 45 | 0 | 1 | 0 | 1
0 | 29 | 2 | 1 | 4 | 0
0 | 65 | 2 | 1 | 0 | 0
0 | 69 | 0 | 1 | 4 | 0
0 | 89 | 2 | 1 | 4 | 0
(7 rows)
alter table part_t1_1_prt_other_b_2_prt_2_3_prt_others_d set with (reshuffle);
select gp_segment_id, * from part_t1_1_prt_other_b_2_prt_2_3_prt_others_d;
gp_segment_id | a | b | c | d | e
---------------+----+---+---+---+---
0 | 29 | 2 | 1 | 4 | 0
0 | 89 | 2 | 1 | 4 | 0
1 | 5 | 2 | 1 | 0 | 1
1 | 9 | 0 | 1 | 4 | 1
1 | 45 | 0 | 1 | 0 | 1
2 | 65 | 2 | 1 | 0 | 0
2 | 69 | 0 | 1 | 4 | 0
(7 rows)
-- try to reshuffle root partition, it will raise a notice
Alter table part_t1 set with (reshuffle);
NOTICE: Do not need to reshuffle public.part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
-- try to reshuffle root partition, should success
Alter table part_t1 expand table;
Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -1016,7 +990,7 @@ select count(*) > 0 from inherit_t1_p1 where gp_segment_id = 2;
(1 row)
begin;
alter table inherit_t1_p1
set with(reshuffle)
;
alter table inherit_t1_p1
expand table
;
select count(*) > 0 from inherit_t1_p1 where gp_segment_id = 2;
?column?
----------
...
...
@@ -1030,7 +1004,7 @@ select count(*) > 0 from inherit_t1_p1 where gp_segment_id = 2;
f
(1 row)
alter table inherit_t1_p1
set with(reshuffle)
;
alter table inherit_t1_p1
expand table
;
select count(*) > 0 from inherit_t1_p1 where gp_segment_id = 2;
?column?
----------
...
...
src/test/regress/expected/reshuffle_ao.out
浏览文件 @
64cdd47c
...
...
@@ -25,7 +25,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
(2 rows)
begin;
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -42,7 +42,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
0 | 49
(2 rows)
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -75,7 +75,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
(1 row)
begin;
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -91,7 +91,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
0 | 100
(1 row)
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -132,7 +132,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
(2 rows)
begin;
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -149,7 +149,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
0 | 4
(2 rows)
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -183,7 +183,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
(1 row)
begin;
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -199,7 +199,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
0 | 100
(1 row)
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -238,7 +238,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -264,7 +264,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
f
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -307,7 +307,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -333,7 +333,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
f
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -377,7 +377,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -403,7 +403,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
f
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -439,7 +439,7 @@ Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -455,7 +455,7 @@ Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
0 | 100
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -488,7 +488,7 @@ Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -504,7 +504,7 @@ Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
0 | 100
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -584,7 +584,7 @@ Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
(2 rows)
begin;
Alter table part_t1
set with (reshuffle)
;
Alter table part_t1
expand table
;
Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -601,7 +601,7 @@ Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
0 | 49
(2 rows)
Alter table part_t1
set with (reshuffle)
;
Alter table part_t1
expand table
;
Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -686,7 +686,7 @@ Select count(*) > 0 from part_t1 where gp_segment_id=2;
(1 row)
begin;
Alter table part_t1
set with (reshuffle)
;
Alter table part_t1
expand table
;
Select count(*) from part_t1;
count
-------
...
...
@@ -712,7 +712,7 @@ Select count(*) > 0 from part_t1 where gp_segment_id=2;
f
(1 row)
Alter table part_t1
set with (reshuffle)
;
Alter table part_t1
expand table
;
Select count(*) from part_t1;
count
-------
...
...
@@ -732,7 +732,7 @@ select numsegments from gp_distribution_policy where localoid='part_t1'::regclas
(1 row)
drop table part_t1;
-- only reshuffle leaf partitions
-- only reshuffle leaf partitions
, not allowed now
select gp_debug_set_create_table_default_numsegments(2);
gp_debug_set_create_table_default_numsegments
-----------------------------------------------
...
...
@@ -791,58 +791,33 @@ Update part_t1 set e = gp_segment_id;
select gp_segment_id, * from part_t1_1_prt_other_b_2_prt_2_3_prt_others_d;
gp_segment_id | a | b | c | d | e
---------------+----+---+---+---+---
1 | 5 | 2 | 1 | 0 | 1
1 | 9 | 0 | 1 | 4 | 1
1 | 45 | 0 | 1 | 0 | 1
0 | 29 | 2 | 1 | 4 | 0
0 | 65 | 2 | 1 | 0 | 0
0 | 69 | 0 | 1 | 4 | 0
0 | 89 | 2 | 1 | 4 | 0
(7 rows)
begin;
alter table part_t1_1_prt_other_b_2_prt_2_3_prt_others_d set with (reshuffle);
select gp_segment_id, * from part_t1_1_prt_other_b_2_prt_2_3_prt_others_d;
gp_segment_id | a | b | c | d | e
---------------+----+---+---+---+---
1 | 5 | 2 | 1 | 0 | 1
1 | 9 | 0 | 1 | 4 | 1
1 | 45 | 0 | 1 | 0 | 1
2 | 65 | 2 | 1 | 0 | 0
2 | 69 | 0 | 1 | 4 | 0
0 | 29 | 2 | 1 | 4 | 0
0 | 89 | 2 | 1 | 4 | 0
(7 rows)
abort;
alter table part_t1_1_prt_other_b_2_prt_2_3_prt_others_d expand table;
ERROR: cannot expand leaf or interior partition "part_t1_1_prt_other_b_2_prt_2_3_prt_others_d"
DETAIL: root/leaf/interior partitions need to have same numsegments
HINT: use "ALTER TABLE part_t1 EXPAND TABLE" instead
select gp_segment_id, * from part_t1_1_prt_other_b_2_prt_2_3_prt_others_d;
gp_segment_id | a | b | c | d | e
---------------+----+---+---+---+---
1 | 5 | 2 | 1 | 0 | 1
1 | 9 | 0 | 1 | 4 | 1
1 | 45 | 0 | 1 | 0 | 1
0 | 29 | 2 | 1 | 4 | 0
0 | 65 | 2 | 1 | 0 | 0
0 | 69 | 0 | 1 | 4 | 0
0 | 89 | 2 | 1 | 4 | 0
(7 rows)
alter table part_t1_1_prt_other_b_2_prt_2_3_prt_others_d set with (reshuffle);
select gp_segment_id, * from part_t1_1_prt_other_b_2_prt_2_3_prt_others_d;
gp_segment_id | a | b | c | d | e
---------------+----+---+---+---+---
2 | 65 | 2 | 1 | 0 | 0
2 | 69 | 0 | 1 | 4 | 0
1 | 5 | 2 | 1 | 0 | 1
1 | 9 | 0 | 1 | 4 | 1
1 | 45 | 0 | 1 | 0 | 1
0 | 29 | 2 | 1 | 4 | 0
0 | 89 | 2 | 1 | 4 | 0
(7 rows)
-- try to reshuffle root partition, it will raise a notice
Alter table part_t1 set with (reshuffle);
NOTICE: Do not need to reshuffle public.part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
-- try to reshuffle root partition, should success
Alter table part_t1 expand table;
Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
src/test/regress/expected/reshuffle_aoco.out
浏览文件 @
64cdd47c
...
...
@@ -25,7 +25,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
(2 rows)
begin;
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -42,7 +42,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
0 | 49
(2 rows)
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -74,7 +74,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
(1 row)
begin;
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -90,7 +90,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
0 | 100
(1 row)
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -131,7 +131,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
(2 rows)
begin;
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -148,7 +148,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
0 | 4
(2 rows)
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -182,7 +182,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
(1 row)
begin;
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -198,7 +198,7 @@ Select gp_segment_id, count(*) from t1 group by gp_segment_id;
0 | 100
(1 row)
Alter table t1
set with (reshuffle)
;
Alter table t1
expand table
;
Select gp_segment_id, count(*) from t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -237,7 +237,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -263,7 +263,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
f
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -305,7 +305,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -331,7 +331,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
f
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -375,7 +375,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -401,7 +401,7 @@ Select count(*) > 0 from r1 where gp_segment_id=2;
f
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select count(*) from r1;
count
-------
...
...
@@ -437,7 +437,7 @@ Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -453,7 +453,7 @@ Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
0 | 100
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -485,7 +485,7 @@ Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
(1 row)
begin;
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -501,7 +501,7 @@ Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
0 | 100
(1 row)
Alter table r1
set with (reshuffle)
;
Alter table r1
expand table
;
Select gp_segment_id, count(*) from gp_dist_random('r1') group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -581,7 +581,7 @@ Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
(2 rows)
begin;
Alter table part_t1
set with (reshuffle)
;
Alter table part_t1
expand table
;
Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -598,7 +598,7 @@ Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
0 | 49
(2 rows)
Alter table part_t1
set with (reshuffle)
;
Alter table part_t1
expand table
;
Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
@@ -683,7 +683,7 @@ Select count(*) > 0 from part_t1 where gp_segment_id=2;
(1 row)
begin;
Alter table part_t1
set with (reshuffle)
;
Alter table part_t1
expand table
;
Select count(*) from part_t1;
count
-------
...
...
@@ -709,7 +709,7 @@ Select count(*) > 0 from part_t1 where gp_segment_id=2;
f
(1 row)
Alter table part_t1
set with (reshuffle)
;
Alter table part_t1
expand table
;
Select count(*) from part_t1;
count
-------
...
...
@@ -729,7 +729,7 @@ select numsegments from gp_distribution_policy where localoid='part_t1'::regclas
(1 row)
drop table part_t1;
-- only reshuffle leaf partitions
-- only reshuffle leaf partitions
, not allowed now.
select gp_debug_set_create_table_default_numsegments(2);
gp_debug_set_create_table_default_numsegments
-----------------------------------------------
...
...
@@ -788,58 +788,33 @@ Update part_t1 set e = gp_segment_id;
select gp_segment_id, * from part_t1_1_prt_other_b_2_prt_2_3_prt_others_d;
gp_segment_id | a | b | c | d | e
---------------+----+---+---+---+---
1 | 5 | 2 | 1 | 0 | 1
1 | 9 | 0 | 1 | 4 | 1
1 | 45 | 0 | 1 | 0 | 1
0 | 29 | 2 | 1 | 4 | 0
0 | 65 | 2 | 1 | 0 | 0
0 | 69 | 0 | 1 | 4 | 0
0 | 89 | 2 | 1 | 4 | 0
(7 rows)
begin;
alter table part_t1_1_prt_other_b_2_prt_2_3_prt_others_d set with (reshuffle);
select gp_segment_id, * from part_t1_1_prt_other_b_2_prt_2_3_prt_others_d;
gp_segment_id | a | b | c | d | e
---------------+----+---+---+---+---
1 | 5 | 2 | 1 | 0 | 1
1 | 9 | 0 | 1 | 4 | 1
1 | 45 | 0 | 1 | 0 | 1
0 | 29 | 2 | 1 | 4 | 0
0 | 89 | 2 | 1 | 4 | 0
2 | 65 | 2 | 1 | 0 | 0
2 | 69 | 0 | 1 | 4 | 0
(7 rows)
abort;
alter table part_t1_1_prt_other_b_2_prt_2_3_prt_others_d expand table;
ERROR: cannot expand leaf or interior partition "part_t1_1_prt_other_b_2_prt_2_3_prt_others_d"
DETAIL: root/leaf/interior partitions need to have same numsegments
HINT: use "ALTER TABLE part_t1 EXPAND TABLE" instead
select gp_segment_id, * from part_t1_1_prt_other_b_2_prt_2_3_prt_others_d;
gp_segment_id | a | b | c | d | e
---------------+----+---+---+---+---
1 | 5 | 2 | 1 | 0 | 1
1 | 9 | 0 | 1 | 4 | 1
1 | 45 | 0 | 1 | 0 | 1
0 | 29 | 2 | 1 | 4 | 0
0 | 65 | 2 | 1 | 0 | 0
0 | 69 | 0 | 1 | 4 | 0
0 | 89 | 2 | 1 | 4 | 0
(7 rows)
alter table part_t1_1_prt_other_b_2_prt_2_3_prt_others_d set with (reshuffle);
select gp_segment_id, * from part_t1_1_prt_other_b_2_prt_2_3_prt_others_d;
gp_segment_id | a | b | c | d | e
---------------+----+---+---+---+---
2 | 65 | 2 | 1 | 0 | 0
2 | 69 | 0 | 1 | 4 | 0
0 | 29 | 2 | 1 | 4 | 0
0 | 89 | 2 | 1 | 4 | 0
1 | 5 | 2 | 1 | 0 | 1
1 | 9 | 0 | 1 | 4 | 1
1 | 45 | 0 | 1 | 0 | 1
(7 rows)
-- try to reshuffle root partition, it will raise a notice
Alter table part_t1 set with (reshuffle);
NOTICE: Do not need to reshuffle public.part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
-- try to reshuffle root partition, should success
Alter table part_t1 expand table;
Select gp_segment_id, count(*) from part_t1 group by gp_segment_id;
gp_segment_id | count
---------------+-------
...
...
src/test/regress/sql/reshuffle.sql
浏览文件 @
64cdd47c
...
...
@@ -19,13 +19,13 @@ Update t1 set c = gp_segment_id;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
begin
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
...
...
@@ -41,13 +41,13 @@ Update t1 set c = gp_segment_id;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
begin
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
...
...
@@ -69,13 +69,13 @@ insert into t1 values
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
begin
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
...
...
@@ -89,13 +89,13 @@ insert into t1 select i,i,0 from generate_series(1,100) I;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
begin
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
...
...
@@ -112,7 +112,7 @@ Select count(*) from r1;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
abort
;
...
...
@@ -120,7 +120,7 @@ abort;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
...
...
@@ -137,7 +137,7 @@ Select count(*) from r1;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
abort
;
...
...
@@ -145,7 +145,7 @@ abort;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
...
...
@@ -161,7 +161,7 @@ Select count(*) from r1;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
abort
;
...
...
@@ -169,7 +169,7 @@ abort;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
...
...
@@ -186,13 +186,13 @@ insert into r1 select i,i,0 from generate_series(1,100) I;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
...
...
@@ -208,13 +208,13 @@ insert into r1 select i,i,0 from generate_series(1,100) I;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
...
...
@@ -248,7 +248,7 @@ FOR EACH STATEMENT EXECUTE PROCEDURE trigger_func('before_stmt');
-- update should fail
update
table_with_update_trigger
set
a
=
a
+
1
;
-- reshuffle should success and not hiting any triggers.
Alter
table
table_with_update_trigger
set
with
(
reshuffle
)
;
Alter
table
table_with_update_trigger
expand
table
;
select
gp_segment_id
,
count
(
*
)
from
table_with_update_trigger
group
by
1
order
by
1
;
--
-- Test reshuffle inheritance parent table, parent table has different numsegments with
...
...
@@ -269,7 +269,7 @@ update mix_base_tbl set a=a+1;
select
gp_segment_id
,
*
from
mix_base_tbl
order
by
2
,
1
;
-- reshuffle the parent table, both parent and child table will be rebalanced to all
-- segments
Alter
table
mix_base_tbl
set
with
(
reshuffle
)
;
Alter
table
mix_base_tbl
expand
table
;
select
gp_segment_id
,
*
from
mix_base_tbl
order
by
2
,
1
;
-- multi-level partition tables
...
...
@@ -298,13 +298,13 @@ Update part_t1 set e = gp_segment_id;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
begin
;
Alter
table
part_t1
set
with
(
reshuffle
)
;
Alter
table
part_t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
Alter
table
part_t1
set
with
(
reshuffle
)
;
Alter
table
part_t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
...
...
@@ -338,7 +338,7 @@ Select count(*) from part_t1;
Select
count
(
*
)
>
0
from
part_t1
where
gp_segment_id
=
2
;
begin
;
Alter
table
part_t1
set
with
(
reshuffle
)
;
Alter
table
part_t1
expand
table
;
Select
count
(
*
)
from
part_t1
;
Select
count
(
*
)
>
0
from
part_t1
where
gp_segment_id
=
2
;
abort
;
...
...
@@ -346,7 +346,7 @@ abort;
Select
count
(
*
)
from
part_t1
;
Select
count
(
*
)
>
0
from
part_t1
where
gp_segment_id
=
2
;
Alter
table
part_t1
set
with
(
reshuffle
)
;
Alter
table
part_t1
expand
table
;
Select
count
(
*
)
from
part_t1
;
Select
count
(
*
)
>
0
from
part_t1
where
gp_segment_id
=
2
;
...
...
@@ -354,7 +354,7 @@ Select count(*) > 0 from part_t1 where gp_segment_id=2;
select
numsegments
from
gp_distribution_policy
where
localoid
=
'part_t1'
::
regclass
;
drop
table
part_t1
;
-- only reshuffle leaf partitions
-- only reshuffle leaf partitions
, not allowed now
select
gp_debug_set_create_table_default_numsegments
(
2
);
CREATE
TABLE
part_t1
(
a
int
,
b
int
,
c
int
,
d
int
,
e
int
)
DISTRIBUTED
BY
(
a
)
...
...
@@ -379,17 +379,11 @@ Update part_t1 set e = gp_segment_id;
select
gp_segment_id
,
*
from
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
;
begin
;
alter
table
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
set
with
(
reshuffle
);
select
gp_segment_id
,
*
from
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
;
abort
;
select
gp_segment_id
,
*
from
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
;
alter
table
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
set
with
(
reshuffle
);
alter
table
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
expand
table
;
select
gp_segment_id
,
*
from
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
;
-- try to reshuffle root partition,
it will raise a notice
Alter
table
part_t1
set
with
(
reshuffle
)
;
-- try to reshuffle root partition,
should success
Alter
table
part_t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
drop
table
part_t1
;
...
...
@@ -412,13 +406,13 @@ insert into inherit_t1_p5 select i,i from generate_series(1,10) i;
select
count
(
*
)
>
0
from
inherit_t1_p1
where
gp_segment_id
=
2
;
begin
;
alter
table
inherit_t1_p1
set
with
(
reshuffle
)
;
alter
table
inherit_t1_p1
expand
table
;
select
count
(
*
)
>
0
from
inherit_t1_p1
where
gp_segment_id
=
2
;
abort
;
select
count
(
*
)
>
0
from
inherit_t1_p1
where
gp_segment_id
=
2
;
alter
table
inherit_t1_p1
set
with
(
reshuffle
)
;
alter
table
inherit_t1_p1
expand
table
;
select
count
(
*
)
>
0
from
inherit_t1_p1
where
gp_segment_id
=
2
;
...
...
src/test/regress/sql/reshuffle_ao.sql
浏览文件 @
64cdd47c
...
...
@@ -19,13 +19,13 @@ Update t1 set c = gp_segment_id;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
begin
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
...
...
@@ -41,13 +41,13 @@ Update t1 set c = gp_segment_id;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
begin
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
...
...
@@ -69,13 +69,13 @@ insert into t1 values
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
begin
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
...
...
@@ -89,13 +89,13 @@ insert into t1 select i,i,0 from generate_series(1,100) I;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
begin
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
...
...
@@ -112,7 +112,7 @@ Select count(*) from r1;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
abort
;
...
...
@@ -120,7 +120,7 @@ abort;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
...
...
@@ -137,7 +137,7 @@ Select count(*) from r1;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
abort
;
...
...
@@ -145,7 +145,7 @@ abort;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
...
...
@@ -161,7 +161,7 @@ Select count(*) from r1;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
abort
;
...
...
@@ -169,7 +169,7 @@ abort;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
...
...
@@ -186,13 +186,13 @@ insert into r1 select i,i,0 from generate_series(1,100) I;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
...
...
@@ -208,13 +208,13 @@ insert into r1 select i,i,0 from generate_series(1,100) I;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
...
...
@@ -247,13 +247,13 @@ Update part_t1 set e = gp_segment_id;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
begin
;
Alter
table
part_t1
set
with
(
reshuffle
)
;
Alter
table
part_t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
Alter
table
part_t1
set
with
(
reshuffle
)
;
Alter
table
part_t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
...
...
@@ -287,7 +287,7 @@ Select count(*) from part_t1;
Select
count
(
*
)
>
0
from
part_t1
where
gp_segment_id
=
2
;
begin
;
Alter
table
part_t1
set
with
(
reshuffle
)
;
Alter
table
part_t1
expand
table
;
Select
count
(
*
)
from
part_t1
;
Select
count
(
*
)
>
0
from
part_t1
where
gp_segment_id
=
2
;
abort
;
...
...
@@ -295,7 +295,7 @@ abort;
Select
count
(
*
)
from
part_t1
;
Select
count
(
*
)
>
0
from
part_t1
where
gp_segment_id
=
2
;
Alter
table
part_t1
set
with
(
reshuffle
)
;
Alter
table
part_t1
expand
table
;
Select
count
(
*
)
from
part_t1
;
Select
count
(
*
)
>
0
from
part_t1
where
gp_segment_id
=
2
;
...
...
@@ -303,7 +303,7 @@ Select count(*) > 0 from part_t1 where gp_segment_id=2;
select
numsegments
from
gp_distribution_policy
where
localoid
=
'part_t1'
::
regclass
;
drop
table
part_t1
;
-- only reshuffle leaf partitions
-- only reshuffle leaf partitions
, not allowed now
select
gp_debug_set_create_table_default_numsegments
(
2
);
CREATE
TABLE
part_t1
(
a
int
,
b
int
,
c
int
,
d
int
,
e
int
)
DISTRIBUTED
BY
(
a
)
...
...
@@ -328,17 +328,11 @@ Update part_t1 set e = gp_segment_id;
select
gp_segment_id
,
*
from
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
;
begin
;
alter
table
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
set
with
(
reshuffle
);
select
gp_segment_id
,
*
from
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
;
abort
;
select
gp_segment_id
,
*
from
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
;
alter
table
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
set
with
(
reshuffle
);
alter
table
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
expand
table
;
select
gp_segment_id
,
*
from
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
;
-- try to reshuffle root partition,
it will raise a notice
Alter
table
part_t1
set
with
(
reshuffle
)
;
-- try to reshuffle root partition,
should success
Alter
table
part_t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
drop
table
part_t1
;
src/test/regress/sql/reshuffle_aoco.sql
浏览文件 @
64cdd47c
...
...
@@ -19,13 +19,13 @@ Update t1 set c = gp_segment_id;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
begin
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
...
...
@@ -41,13 +41,13 @@ Update t1 set c = gp_segment_id;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
begin
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
...
...
@@ -69,13 +69,13 @@ insert into t1 values
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
begin
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
...
...
@@ -89,13 +89,13 @@ insert into t1 select i,i,0 from generate_series(1,100) I;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
begin
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
Alter
table
t1
set
with
(
reshuffle
)
;
Alter
table
t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
t1
group
by
gp_segment_id
;
...
...
@@ -112,7 +112,7 @@ Select count(*) from r1;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
abort
;
...
...
@@ -120,7 +120,7 @@ abort;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
...
...
@@ -137,7 +137,7 @@ Select count(*) from r1;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
abort
;
...
...
@@ -145,7 +145,7 @@ abort;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
...
...
@@ -161,7 +161,7 @@ Select count(*) from r1;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
abort
;
...
...
@@ -169,7 +169,7 @@ abort;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
count
(
*
)
from
r1
;
Select
count
(
*
)
>
0
from
r1
where
gp_segment_id
=
2
;
...
...
@@ -186,13 +186,13 @@ insert into r1 select i,i,0 from generate_series(1,100) I;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
...
...
@@ -208,13 +208,13 @@ insert into r1 select i,i,0 from generate_series(1,100) I;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
begin
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
Alter
table
r1
set
with
(
reshuffle
)
;
Alter
table
r1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
gp_dist_random
(
'r1'
)
group
by
gp_segment_id
;
...
...
@@ -247,13 +247,13 @@ Update part_t1 set e = gp_segment_id;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
begin
;
Alter
table
part_t1
set
with
(
reshuffle
)
;
Alter
table
part_t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
abort
;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
Alter
table
part_t1
set
with
(
reshuffle
)
;
Alter
table
part_t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
...
...
@@ -287,7 +287,7 @@ Select count(*) from part_t1;
Select
count
(
*
)
>
0
from
part_t1
where
gp_segment_id
=
2
;
begin
;
Alter
table
part_t1
set
with
(
reshuffle
)
;
Alter
table
part_t1
expand
table
;
Select
count
(
*
)
from
part_t1
;
Select
count
(
*
)
>
0
from
part_t1
where
gp_segment_id
=
2
;
abort
;
...
...
@@ -295,7 +295,7 @@ abort;
Select
count
(
*
)
from
part_t1
;
Select
count
(
*
)
>
0
from
part_t1
where
gp_segment_id
=
2
;
Alter
table
part_t1
set
with
(
reshuffle
)
;
Alter
table
part_t1
expand
table
;
Select
count
(
*
)
from
part_t1
;
Select
count
(
*
)
>
0
from
part_t1
where
gp_segment_id
=
2
;
...
...
@@ -303,7 +303,7 @@ Select count(*) > 0 from part_t1 where gp_segment_id=2;
select
numsegments
from
gp_distribution_policy
where
localoid
=
'part_t1'
::
regclass
;
drop
table
part_t1
;
-- only reshuffle leaf partitions
-- only reshuffle leaf partitions
, not allowed now.
select
gp_debug_set_create_table_default_numsegments
(
2
);
CREATE
TABLE
part_t1
(
a
int
,
b
int
,
c
int
,
d
int
,
e
int
)
DISTRIBUTED
BY
(
a
)
...
...
@@ -328,17 +328,11 @@ Update part_t1 set e = gp_segment_id;
select
gp_segment_id
,
*
from
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
;
begin
;
alter
table
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
set
with
(
reshuffle
);
select
gp_segment_id
,
*
from
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
;
abort
;
select
gp_segment_id
,
*
from
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
;
alter
table
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
set
with
(
reshuffle
);
alter
table
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
expand
table
;
select
gp_segment_id
,
*
from
part_t1_1_prt_other_b_2_prt_2_3_prt_others_d
;
-- try to reshuffle root partition,
it will raise a notice
Alter
table
part_t1
set
with
(
reshuffle
)
;
-- try to reshuffle root partition,
should success
Alter
table
part_t1
expand
table
;
Select
gp_segment_id
,
count
(
*
)
from
part_t1
group
by
gp_segment_id
;
drop
table
part_t1
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录