gangsize_optimizer_1.out 17.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
set allow_system_table_mods = true;
create temp table random_2_0 (a int, b int, c int, d int) distributed randomly;
update gp_distribution_policy set numsegments = 2 where localoid = 'random_2_0'::regclass;
insert into random_2_0 select i,i,i,i from generate_series(1, 10)i;
create temp table replicate_2_1 (a int, b int, c int, d int) distributed replicated;
update gp_distribution_policy set numsegments = 2 where localoid = 'replicate_2_1'::regclass;
insert into replicate_2_1 select i,i,i,i from generate_series(1, 10)i;
create temp table hash_3_3_2 (a int, b int, c int, d int) distributed by (a,b,c);
update gp_distribution_policy set numsegments = 3 where localoid = 'hash_3_3_2'::regclass;
insert into hash_3_3_2 select i,i,i,i from generate_series(1, 10)i;
create temp table replicate_3_3 (a int, b int, c int, d int) distributed replicated;
update gp_distribution_policy set numsegments = 3 where localoid = 'replicate_3_3'::regclass;
insert into replicate_3_3 select i,i,i,i from generate_series(1, 10)i;
create temp table hash_2_3_4 (a int, b int, c int, d int) distributed by (a,b,c);
update gp_distribution_policy set numsegments = 2 where localoid = 'hash_2_3_4'::regclass;
insert into hash_2_3_4 select i,i,i,i from generate_series(1, 10)i;
create temp table replicate_2_5 (a int, b int, c int, d int) distributed replicated;
update gp_distribution_policy set numsegments = 2 where localoid = 'replicate_2_5'::regclass;
insert into replicate_2_5 select i,i,i,i from generate_series(1, 10)i;
set Test_print_direct_dispatch_info = true;
\o /dev/null
-- This test focuses on the whether slices' corresponding gang size in runtime.
-- So we enable the GUC Test_print_direct_dispatch_info to display dispatch info.
-- The following sqls are generated by a script. These queries are all multi-tables'
-- join and aggregation so they have many slices. We are not interested in their
-- results, so we redirect the output to /dev/null.
-- Some of the queries are only possible with Nested Loop Joins. Enable them, to
-- avoid the really high cost estimates on such plans, which skew the planners
-- decisions.
set enable_nestloop=on;
select replicate_2_1.c, hash_2_3_4.c, avg(hash_3_3_2.d), max(replicate_3_3.c) from ((random_2_0 right join replicate_2_1 on random_2_0.b = replicate_2_1.c) left join (hash_3_3_2 inner join replicate_3_3 on hash_3_3_2.c >= replicate_3_3.b) on replicate_2_1.d >= hash_3_3_2.a) inner join (hash_2_3_4 inner join replicate_2_5 on hash_2_3_4.c = replicate_2_5.d) on hash_3_3_2.a <> hash_2_3_4.a group by replicate_2_1.c, hash_2_3_4.c order by 1,2;
INFO:  (slice 3) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 4) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 5) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 1) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 2) Dispatch command to SINGLE content
select hash_3_3_2.b, replicate_2_5.d, sum(replicate_2_1.d), sum(replicate_3_3.a) from (((random_2_0 left join replicate_2_1 on random_2_0.b <> replicate_2_1.d) left join hash_3_3_2 on random_2_0.c = hash_3_3_2.b) inner join (replicate_3_3 inner join hash_2_3_4 on replicate_3_3.d = hash_2_3_4.d) on hash_3_3_2.a <> hash_2_3_4.a) right join replicate_2_5 on random_2_0.d <> replicate_2_5.c group by hash_3_3_2.b, replicate_2_5.d order by 1,2;
INFO:  (slice 3) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 4) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 2) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 1) Dispatch command to SINGLE content
select replicate_3_3.a, hash_2_3_4.d, sum(replicate_2_1.a), max(hash_3_3_2.d) from (((random_2_0 right join replicate_2_1 on random_2_0.d >= replicate_2_1.c) left join (hash_3_3_2 full join replicate_3_3 on hash_3_3_2.b = replicate_3_3.a) on replicate_2_1.a < hash_3_3_2.c) full join hash_2_3_4 on random_2_0.a >= hash_2_3_4.b) inner join replicate_2_5 on hash_3_3_2.c < replicate_2_5.d group by replicate_3_3.a, hash_2_3_4.d order by 1,2;
INFO:  (slice 4) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 2) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 3) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 1) Dispatch command to SINGLE content
INFO:  (slice 5) Dispatch command to SINGLE content
select replicate_3_3.d, replicate_2_1.d, avg(random_2_0.c), max(hash_3_3_2.a) from ((((random_2_0 left join replicate_2_1 on random_2_0.c <= replicate_2_1.d) full join hash_3_3_2 on random_2_0.a > hash_3_3_2.d) full join replicate_3_3 on hash_3_3_2.a >= replicate_3_3.b) right join hash_2_3_4 on random_2_0.a = hash_2_3_4.b) left join replicate_2_5 on random_2_0.a > replicate_2_5.b group by replicate_3_3.d, replicate_2_1.d order by 1,2;
INFO:  (slice 4) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 1) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 5) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 3) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 2) Dispatch command to PARTIAL contents: 0 1
select hash_3_3_2.b, replicate_2_1.c, max(replicate_3_3.d), avg(random_2_0.a) from (random_2_0 right join (replicate_2_1 left join hash_3_3_2 on replicate_2_1.b <> hash_3_3_2.b) on random_2_0.a <> hash_3_3_2.a) right join ((replicate_3_3 inner join hash_2_3_4 on replicate_3_3.b < hash_2_3_4.c) left join replicate_2_5 on hash_2_3_4.b < replicate_2_5.d) on hash_3_3_2.a > hash_2_3_4.b group by hash_3_3_2.b, replicate_2_1.c order by 1,2;
INFO:  (slice 3) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 1) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 4) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 2) Dispatch command to SINGLE content
select replicate_2_1.c, random_2_0.c, sum(replicate_3_3.a), max(replicate_2_5.c) from (random_2_0 left join replicate_2_1 on random_2_0.d <= replicate_2_1.b) right join (hash_3_3_2 inner join (replicate_3_3 inner join (hash_2_3_4 right join replicate_2_5 on hash_2_3_4.b <> replicate_2_5.a) on replicate_3_3.b = hash_2_3_4.b) on hash_3_3_2.a <> replicate_2_5.a) on replicate_2_1.c <> replicate_3_3.c group by replicate_2_1.c, random_2_0.c order by 1,2;
INFO:  (slice 1) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 3) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 5) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 2) Dispatch command to SINGLE content
INFO:  (slice 4) Dispatch command to SINGLE content
select hash_2_3_4.d, replicate_2_1.b, sum(random_2_0.a), count(replicate_2_5.d) from ((random_2_0 left join replicate_2_1 on random_2_0.b = replicate_2_1.b) right join (hash_3_3_2 full join replicate_3_3 on hash_3_3_2.b <= replicate_3_3.d) on replicate_2_1.c > hash_3_3_2.b) inner join (hash_2_3_4 right join replicate_2_5 on hash_2_3_4.a < replicate_2_5.d) on replicate_2_1.b < replicate_2_5.d group by hash_2_3_4.d, replicate_2_1.b order by 1,2;
INFO:  (slice 5) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 2) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 3) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 4) Dispatch command to SINGLE content
INFO:  (slice 1) Dispatch command to SINGLE content
INFO:  (slice 6) Dispatch command to SINGLE content
select replicate_3_3.d, random_2_0.c, count(hash_3_3_2.d), count(hash_2_3_4.b) from ((random_2_0 full join (replicate_2_1 right join hash_3_3_2 on replicate_2_1.b > hash_3_3_2.c) on random_2_0.b >= hash_3_3_2.a) inner join replicate_3_3 on hash_3_3_2.d < replicate_3_3.a) left join (hash_2_3_4 full join replicate_2_5 on hash_2_3_4.a <> replicate_2_5.a) on random_2_0.d = hash_2_3_4.c group by replicate_3_3.d, random_2_0.c order by 1,2;
INFO:  (slice 4) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 1) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 5) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 6) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 2) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 3) Dispatch command to SINGLE content
select random_2_0.d, replicate_2_1.a, max(hash_3_3_2.b), count(replicate_2_5.b) from (random_2_0 left join replicate_2_1 on random_2_0.c <> replicate_2_1.b) inner join (hash_3_3_2 full join ((replicate_3_3 inner join hash_2_3_4 on replicate_3_3.d <> hash_2_3_4.d) left join replicate_2_5 on hash_2_3_4.d < replicate_2_5.b) on hash_3_3_2.c > hash_2_3_4.b) on random_2_0.b < replicate_2_5.d group by random_2_0.d, replicate_2_1.a order by 1,2;
INFO:  (slice 4) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 1) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 3) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 2) Dispatch command to PARTIAL contents: 0 1
select replicate_2_5.c, hash_3_3_2.c, sum(replicate_3_3.c), max(hash_2_3_4.c) from ((random_2_0 inner join replicate_2_1 on random_2_0.a = replicate_2_1.d) right join hash_3_3_2 on replicate_2_1.c <> hash_3_3_2.c) left join ((replicate_3_3 inner join hash_2_3_4 on replicate_3_3.d <= hash_2_3_4.c) right join replicate_2_5 on replicate_3_3.d > replicate_2_5.b) on hash_3_3_2.b = hash_2_3_4.b group by replicate_2_5.c, hash_3_3_2.c order by 1,2;
INFO:  (slice 4) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 1) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 3) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 5) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 2) Dispatch command to PARTIAL contents: 0 1
select hash_3_3_2.a, replicate_3_3.b, max(random_2_0.c), sum(replicate_2_1.a) from random_2_0 full join (replicate_2_1 inner join ((hash_3_3_2 inner join (replicate_3_3 inner join hash_2_3_4 on replicate_3_3.d >= hash_2_3_4.d) on hash_3_3_2.c >= replicate_3_3.d) inner join replicate_2_5 on replicate_3_3.b <= replicate_2_5.d) on replicate_2_1.c > replicate_3_3.a) on random_2_0.d = hash_3_3_2.d group by hash_3_3_2.a, replicate_3_3.b order by 1,2;
INFO:  (slice 4) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 1) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 5) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 6) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 2) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 3) Dispatch command to SINGLE content
select replicate_2_1.d, random_2_0.c, sum(hash_3_3_2.d), max(replicate_3_3.d) from (random_2_0 right join (replicate_2_1 inner join hash_3_3_2 on replicate_2_1.d >= hash_3_3_2.c) on random_2_0.c <= hash_3_3_2.c) inner join ((replicate_3_3 full join hash_2_3_4 on replicate_3_3.d <= hash_2_3_4.b) left join replicate_2_5 on replicate_3_3.d <= replicate_2_5.b) on random_2_0.b > replicate_2_5.b group by replicate_2_1.d, random_2_0.c order by 1,2;
INFO:  (slice 2) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 3) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 5) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 4) Dispatch command to SINGLE content
INFO:  (slice 6) Dispatch command to SINGLE content
INFO:  (slice 1) Dispatch command to SINGLE content
select replicate_3_3.d, hash_3_3_2.a, avg(replicate_2_5.d), max(replicate_2_1.d) from random_2_0 right join ((replicate_2_1 right join hash_3_3_2 on replicate_2_1.b <= hash_3_3_2.a) inner join (replicate_3_3 right join (hash_2_3_4 right join replicate_2_5 on hash_2_3_4.c = replicate_2_5.d) on replicate_3_3.b >= hash_2_3_4.c) on hash_3_3_2.b <> hash_2_3_4.c) on random_2_0.c >= hash_2_3_4.b group by replicate_3_3.d, hash_3_3_2.a order by 1,2;
INFO:  (slice 5) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 1) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 3) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 2) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 4) Dispatch command to SINGLE content
select hash_2_3_4.c, replicate_2_1.b, sum(replicate_3_3.b), avg(replicate_2_5.a) from random_2_0 left join (replicate_2_1 right join ((hash_3_3_2 left join replicate_3_3 on hash_3_3_2.d >= replicate_3_3.b) right join (hash_2_3_4 right join replicate_2_5 on hash_2_3_4.d <> replicate_2_5.d) on replicate_3_3.d <= replicate_2_5.a) on replicate_2_1.b <= replicate_2_5.d) on random_2_0.a < replicate_3_3.a group by hash_2_3_4.c, replicate_2_1.b order by 1,2;
INFO:  (slice 3) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 1) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 4) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 2) Dispatch command to SINGLE content
-- Test for BEGIN;
begin;
commit;
begin;
abort;
-- Test for UPDATE/DELETE/INSERT;
-- Insert
insert into random_2_0 select i,i,i,i from generate_series(21, 30)i;
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 1) Dispatch command to SINGLE content
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to ALL contents: 0 1 2
begin;
insert into random_2_0 select i,i,i,i from generate_series(21, 30)i;
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 1) Dispatch command to SINGLE content
end;
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to ALL contents: 0 1 2
insert into replicate_2_1 select i,i,i,i from generate_series(21, 30)i;
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to PARTIAL contents: 0 1
begin;
insert into replicate_2_1 select i,i,i,i from generate_series(21, 30)i;
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
end;
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to PARTIAL contents: 0 1
insert into hash_3_3_2 select i,i,i,i from generate_series(21, 30)i;
INFO:  (slice 0) Dispatch command to ALL contents: 0 1 2
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to ALL contents: 0 1 2
begin;
insert into hash_3_3_2 select i,i,i,i from generate_series(21, 30)i;
INFO:  (slice 0) Dispatch command to ALL contents: 0 1 2
end;
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to ALL contents: 0 1 2
insert into replicate_3_3 select i,i,i,i from generate_series(21, 30)i;
INFO:  (slice 0) Dispatch command to ALL contents: 0 1 2
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to ALL contents: 0 1 2
begin;
insert into replicate_3_3 select i,i,i,i from generate_series(21, 30)i;
INFO:  (slice 0) Dispatch command to ALL contents: 0 1 2
end;
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to ALL contents: 0 1 2
insert into hash_2_3_4 select i,i,i,i from generate_series(21, 30)i;
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 1) Dispatch command to SINGLE content
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to ALL contents: 0 1 2
begin;
insert into hash_2_3_4 select i,i,i,i from generate_series(21, 30)i;
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
INFO:  (slice 1) Dispatch command to SINGLE content
end;
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to ALL contents: 0 1 2
--Update
update random_2_0 set a = a + 1;
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to PARTIAL contents: 0 1
begin;
update random_2_0 set a = a + 1;
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
end;
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to PARTIAL contents: 0 1
update random_2_0 set a = 1 from hash_3_3_2 where hash_3_3_2.b = random_2_0.c;
INFO:  (slice 1) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to ALL contents: 0 1 2
begin;
update random_2_0 set a = 1 from hash_3_3_2 where hash_3_3_2.b = random_2_0.c;
INFO:  (slice 1) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
end;
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to ALL contents: 0 1 2
update replicate_2_1 set a = a + 1;
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to PARTIAL contents: 0 1
begin;
update replicate_2_1 set a = a + 1;
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
end;
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to PARTIAL contents: 0 1
-- Delete
delete from hash_2_3_4 where a in (1, 2, 3);
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to PARTIAL contents: 0 1
begin;
delete from hash_2_3_4 where a = 4 or a = 5;
INFO:  (slice 0) Dispatch command to PARTIAL contents: 0 1
end;
INFO:  Distributed transaction command 'Distributed Commit (one-phase)' to PARTIAL contents: 0 1
-- add test for table expand
begin;
alter table random_2_0 expand table;
INFO:  (slice 0) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 1) Dispatch command to PARTIAL contents: 0 1
abort;
INFO:  Distributed transaction command 'Distributed Abort (No Prepared)' to ALL contents: 0 1 2
begin;
alter table replicate_2_1 expand table;
INFO:  (slice 0) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 1) Dispatch command to SINGLE content
abort;
INFO:  Distributed transaction command 'Distributed Abort (No Prepared)' to ALL contents: 0 1 2
begin;
alter table hash_2_3_4 expand table;
INFO:  (slice 0) Dispatch command to ALL contents: 0 1 2
INFO:  (slice 1) Dispatch command to PARTIAL contents: 0 1
abort;
INFO:  Distributed transaction command 'Distributed Abort (No Prepared)' to ALL contents: 0 1 2