From 4bf1d27f91fae2ab646b3bc9eefe672d014a1efc Mon Sep 17 00:00:00 2001 From: Sambitesh Dash Date: Tue, 13 Aug 2019 16:12:21 -0700 Subject: [PATCH] Bump ORCA version --- concourse/tasks/compile_gpdb.yml | 2 +- config/orca.m4 | 4 +- configure | 4 +- depends/conanfile_orca.txt | 2 +- src/test/regress/expected/dpe_optimizer.out | 33 +- .../regress/expected/gporca_optimizer.out | 15 +- .../regress/expected/indexjoin_optimizer.out | 48 ++- .../regress/expected/join_gp_optimizer.out | 57 ++- src/test/regress/expected/join_optimizer.out | 359 +++++++++--------- .../expected/subselect_gp_optimizer.out | 199 +++++----- 10 files changed, 343 insertions(+), 380 deletions(-) diff --git a/concourse/tasks/compile_gpdb.yml b/concourse/tasks/compile_gpdb.yml index 26aaf748fc..d2b384fbb3 100644 --- a/concourse/tasks/compile_gpdb.yml +++ b/concourse/tasks/compile_gpdb.yml @@ -19,4 +19,4 @@ params: BLD_TARGETS: OUTPUT_ARTIFACT_DIR: gpdb_artifacts CONFIGURE_FLAGS: - ORCA_TAG: v3.63.0 + ORCA_TAG: v3.64.0 diff --git a/config/orca.m4 b/config/orca.m4 index 61caeb739c..2503d89765 100644 --- a/config/orca.m4 +++ b/config/orca.m4 @@ -40,10 +40,10 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include ]], [ -return strncmp("3.63.", GPORCA_VERSION_STRING, 5); +return strncmp("3.64.", GPORCA_VERSION_STRING, 5); ])], [AC_MSG_RESULT([[ok]])], -[AC_MSG_ERROR([Your ORCA version is expected to be 3.63.XXX])] +[AC_MSG_ERROR([Your ORCA version is expected to be 3.64.XXX])] ) AC_LANG_POP([C++]) ])# PGAC_CHECK_ORCA_VERSION diff --git a/configure b/configure index 8b1f9d9675..8a37c18993 100755 --- a/configure +++ b/configure @@ -14017,7 +14017,7 @@ int main () { -return strncmp("3.63.", GPORCA_VERSION_STRING, 5); +return strncmp("3.64.", GPORCA_VERSION_STRING, 5); ; return 0; @@ -14027,7 +14027,7 @@ if ac_fn_cxx_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } else - as_fn_error $? "Your ORCA version is expected to be 3.63.XXX" "$LINENO" 5 + as_fn_error $? "Your ORCA version is expected to be 3.64.XXX" "$LINENO" 5 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ diff --git a/depends/conanfile_orca.txt b/depends/conanfile_orca.txt index 70c29461c2..b1a10fa8a7 100644 --- a/depends/conanfile_orca.txt +++ b/depends/conanfile_orca.txt @@ -1,5 +1,5 @@ [requires] -orca/v3.63.0@gpdb/stable +orca/v3.64.0@gpdb/stable [imports] include, * -> build/include diff --git a/src/test/regress/expected/dpe_optimizer.out b/src/test/regress/expected/dpe_optimizer.out index 01de1d9bca..749f965a8b 100644 --- a/src/test/regress/expected/dpe_optimizer.out +++ b/src/test/regress/expected/dpe_optimizer.out @@ -544,24 +544,21 @@ set enable_indexscan=on; set enable_bitmapscan=off; set enable_hashjoin=off; explain select * from t, pt where tid = ptid and pt1 = 'hello0'; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..437.00 rows=1 width=50) - -> Hash Join (cost=0.00..437.00 rows=1 width=50) - Hash Cond: t.tid = pt.ptid - -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=19) - Hash Key: t.tid - -> Seq Scan on t (cost=0.00..431.00 rows=1 width=19) - -> Hash (cost=6.00..6.00 rows=1 width=31) - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..6.00 rows=1 width=31) - Hash Key: pt.ptid - -> Sequence (cost=0.00..6.00 rows=1 width=31) - -> Partition Selector for pt (dynamic scan id: 1) (cost=10.00..100.00 rows=34 width=4) - Partitions selected: 6 (out of 6) - -> Dynamic Index Scan on pt (dynamic scan id: 1) (cost=0.00..6.00 rows=1 width=31) - Index Cond: pt1 = 'hello0'::text - Optimizer: Pivotal Optimizer (GPORCA) version 2.73.0 -(15 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------------------- + Hash Join (cost=0.00..437.00 rows=1 width=50) + Hash Cond: (t.tid = pt.ptid) + -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=2 width=19) + -> Seq Scan on t (cost=0.00..431.00 rows=1 width=19) + -> Hash (cost=6.00..6.00 rows=1 width=31) + -> Gather Motion 3:1 (slice2; segments: 3) (cost=0.00..6.00 rows=1 width=31) + -> Sequence (cost=0.00..6.00 rows=1 width=31) + -> Partition Selector for pt (dynamic scan id: 1) (cost=10.00..100.00 rows=34 width=4) + Partitions selected: 6 (out of 6) + -> Dynamic Index Scan on pt (dynamic scan id: 1) (cost=0.00..6.00 rows=1 width=31) + Index Cond: (pt1 = 'hello0'::text) + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 +(12 rows) select * from t, pt where tid = ptid and pt1 = 'hello0'; dist | tid | t1 | t2 | dist | pt1 | pt2 | pt3 | ptid diff --git a/src/test/regress/expected/gporca_optimizer.out b/src/test/regress/expected/gporca_optimizer.out index 0555394e6b..ec9f75e92c 100644 --- a/src/test/regress/expected/gporca_optimizer.out +++ b/src/test/regress/expected/gporca_optimizer.out @@ -10930,20 +10930,17 @@ FROM (SELECT * QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=0.00..1293.00 rows=1 width=8) - -> Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..1293.00 rows=1 width=8) + -> Gather Motion 3:1 (slice2; segments: 3) (cost=0.00..1293.00 rows=1 width=8) -> Aggregate (cost=0.00..1293.00 rows=1 width=8) -> Append (cost=0.00..1293.00 rows=2 width=1) - -> Result (cost=0.00..862.00 rows=1 width=11) + -> Result (cost=0.00..862.00 rows=1 width=1) -> Hash Left Join (cost=0.00..862.00 rows=1 width=3) - Hash Cond: tab_1.id::text = tab_2.id::text - -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=5) - Hash Key: tab_1.id - -> Seq Scan on tab_1 (cost=0.00..431.00 rows=1 width=5) + Hash Cond: ((tab_1.id)::text = (tab_2.id)::text) + -> Seq Scan on tab_1 (cost=0.00..431.00 rows=1 width=5) -> Hash (cost=431.00..431.00 rows=1 width=7) - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..431.00 rows=1 width=7) - Hash Key: tab_2.id::text + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=7) -> Seq Scan on tab_2 (cost=0.00..431.00 rows=1 width=7) - -> Result (cost=0.00..431.00 rows=1 width=16) + -> Result (cost=0.00..431.00 rows=1 width=1) -> Seq Scan on tab_3 (cost=0.00..431.00 rows=1 width=8) Optimizer: Pivotal Optimizer (GPORCA) version 2.70.2 (17 rows) diff --git a/src/test/regress/expected/indexjoin_optimizer.out b/src/test/regress/expected/indexjoin_optimizer.out index 5209f6b172..ec9fbdece4 100644 --- a/src/test/regress/expected/indexjoin_optimizer.out +++ b/src/test/regress/expected/indexjoin_optimizer.out @@ -27,31 +27,29 @@ WHERE tq.sym = tt.symbol AND tt.event_ts < tq.end_ts GROUP BY 1 ORDER BY 1 asc ; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..878.21 rows=413 width=16) - Merge Key: (my_tt_agg_small.event_ts / 100000 / 5 * 5) - -> GroupAggregate (cost=0.00..878.19 rows=138 width=16) - Group By: (my_tt_agg_small.event_ts / 100000 / 5 * 5) - -> Sort (cost=0.00..878.19 rows=138 width=16) - Sort Key: (my_tt_agg_small.event_ts / 100000 / 5 * 5) - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..878.10 rows=138 width=16) - Hash Key: (my_tt_agg_small.event_ts / 100000 / 5 * 5) - -> Result (cost=0.00..878.09 rows=138 width=16) - -> HashAggregate (cost=0.00..878.09 rows=138 width=16) - Group By: my_tt_agg_small.event_ts / 100000 / 5 * 5 - -> Result (cost=0.00..866.15 rows=94594 width=8) - -> Hash Join (cost=0.00..865.39 rows=94594 width=8) - Hash Cond: my_tq_agg_small.sym::bpchar = my_tt_agg_small.symbol - Join Filter: my_tt_agg_small.event_ts >= my_tq_agg_small.ets AND my_tt_agg_small.event_ts < my_tq_agg_small.end_ts - -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..431.10 rows=676 width=20) - Hash Key: my_tq_agg_small.sym::bpchar - -> Seq Scan on my_tq_agg_small (cost=0.00..431.02 rows=676 width=20) - -> Hash (cost=431.01..431.01 rows=140 width=25) - -> Seq Scan on my_tt_agg_small (cost=0.00..431.01 rows=140 width=25) - Settings: optimizer=on; optimizer_nestloop_factor=1 - Optimizer status: Pivotal Optimizer (GPORCA) version 2.32.0 -(22 rows) + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..878.47 rows=413 width=16) + Merge Key: ((((my_tt_agg_small.event_ts / 100000) / 5) * 5)) + -> GroupAggregate (cost=0.00..878.44 rows=138 width=16) + Group Key: ((((my_tt_agg_small.event_ts / 100000) / 5) * 5)) + -> Sort (cost=0.00..878.44 rows=138 width=16) + Sort Key: ((((my_tt_agg_small.event_ts / 100000) / 5) * 5)) + -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..878.35 rows=138 width=16) + Hash Key: ((((my_tt_agg_small.event_ts / 100000) / 5) * 5)) + -> Result (cost=0.00..878.34 rows=138 width=16) + -> HashAggregate (cost=0.00..878.34 rows=138 width=16) + Group Key: (((my_tt_agg_small.event_ts / 100000) / 5) * 5) + -> Result (cost=0.00..866.40 rows=94594 width=8) + -> Hash Join (cost=0.00..865.64 rows=94594 width=8) + Hash Cond: ((my_tq_agg_small.sym)::text = (my_tt_agg_small.symbol)::text) + Join Filter: ((my_tt_agg_small.event_ts >= my_tq_agg_small.ets) AND (my_tt_agg_small.event_ts < my_tq_agg_small.end_ts)) + -> Seq Scan on my_tq_agg_small (cost=0.00..431.02 rows=676 width=20) + -> Hash (cost=431.30..431.30 rows=420 width=25) + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..431.30 rows=420 width=25) + -> Seq Scan on my_tt_agg_small (cost=0.00..431.01 rows=140 width=25) + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 +(20 rows) SELECT (tt.event_ts / 100000) / 5 * 5 as fivemin, COUNT(*) diff --git a/src/test/regress/expected/join_gp_optimizer.out b/src/test/regress/expected/join_gp_optimizer.out index 56d0f0a799..987a6705dd 100644 --- a/src/test/regress/expected/join_gp_optimizer.out +++ b/src/test/regress/expected/join_gp_optimizer.out @@ -107,20 +107,17 @@ explain select count(*) from t1,t2 where t1.x = 100 and t1.x = t2.x; QUERY PLAN ------------------------------------------------------------------------------------------------------------ Aggregate (cost=0.00..862.00 rows=1 width=8) - -> Gather Motion 3:1 (slice2; segments: 3) (cost=0.00..862.00 rows=1 width=8) - -> Aggregate (cost=0.00..862.00 rows=1 width=8) - -> Hash Join (cost=0.00..862.00 rows=1 width=1) - Hash Cond: t1.x = t2.x - -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=4) - Hash Key: t1.x - -> Seq Scan on t1 (cost=0.00..431.00 rows=1 width=4) - Filter: x = 100 - -> Hash (cost=431.00..431.00 rows=1 width=4) - -> Seq Scan on t2 (cost=0.00..431.00 rows=1 width=4) - Filter: x = 100 - Settings: optimizer=on - Optimizer status: Pivotal Optimizer (GPORCA) version 2.39.2 -(14 rows) + -> Hash Join (cost=0.00..862.00 rows=1 width=1) + Hash Cond: (t1.x = t2.x) + -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=4) + -> Seq Scan on t1 (cost=0.00..431.00 rows=1 width=4) + Filter: (x = 100) + -> Hash (cost=431.00..431.00 rows=1 width=4) + -> Gather Motion 3:1 (slice2; segments: 3) (cost=0.00..431.00 rows=1 width=4) + -> Seq Scan on t2 (cost=0.00..431.00 rows=1 width=4) + Filter: (x = 100) + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 +(11 rows) select count(*) from t1,t2 where t1.x = 100 and t1.x = t2.x; count @@ -156,24 +153,20 @@ select * from t1,t2 where t1.x = 100 and t2.x >= t1.x; -- set optimizer_segments=2; explain select * from t1,t2 where t1.x = 100 and t1.x = t2.y and t1.x <= t2.x; - QUERY PLAN -------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..862.01 rows=1 width=24) - -> Hash Join (cost=0.00..862.01 rows=1 width=24) - Hash Cond: t1.x = t2.y - Join Filter: t1.x <= t2.x - -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=12) - Hash Key: t1.x - -> Seq Scan on t1 (cost=0.00..431.00 rows=1 width=12) - Filter: x = 100 - -> Hash (cost=431.00..431.00 rows=1 width=12) - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..431.00 rows=1 width=12) - Hash Key: t2.y - -> Seq Scan on t2 (cost=0.00..431.00 rows=1 width=12) - Filter: y = 100 - Settings: optimizer=on; optimizer_segments=2 - Optimizer status: Pivotal Optimizer (GPORCA) version 2.39.2 -(15 rows) + QUERY PLAN +------------------------------------------------------------------------------------------- + Hash Join (cost=0.00..862.01 rows=1 width=24) + Hash Cond: (t1.x = t2.y) + Join Filter: (t1.x <= t2.x) + -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=12) + -> Seq Scan on t1 (cost=0.00..431.00 rows=1 width=12) + Filter: (x = 100) + -> Hash (cost=431.00..431.00 rows=1 width=12) + -> Gather Motion 3:1 (slice2; segments: 3) (cost=0.00..431.00 rows=1 width=12) + -> Seq Scan on t2 (cost=0.00..431.00 rows=1 width=12) + Filter: (y = 100) + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 +(11 rows) reset optimizer_segments; select * from t1,t2 where t1.x = 100 and t1.x = t2.y and t1.x <= t2.x; diff --git a/src/test/regress/expected/join_optimizer.out b/src/test/regress/expected/join_optimizer.out index 2fea8e0ba5..dcc9c4da1a 100755 --- a/src/test/regress/expected/join_optimizer.out +++ b/src/test/regress/expected/join_optimizer.out @@ -2908,28 +2908,27 @@ from nt3 as nt3 ) as ss2 on ss2.id = nt3.nt2_id where nt3.id = 1 and ss2.b3; - QUERY PLAN ------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) - -> Hash Join - Hash Cond: (nt3.nt2_id = nt2.id) + QUERY PLAN +------------------------------------------------------------------------------------ + Hash Join + Hash Cond: (nt3.nt2_id = nt2.id) + -> Gather Motion 3:1 (slice1; segments: 3) -> Index Scan using nt3_pkey on nt3 Index Cond: (id = 1) - -> Hash - -> Broadcast Motion 3:3 (slice2; segments: 3) - -> Result - Filter: ((nt2.b1 AND ((NOT (nt1.id IS NULL))))) - -> Result - -> Hash Left Join - Hash Cond: (nt2.nt1_id = nt1.id) - -> Redistribute Motion 3:3 (slice1; segments: 3) - Hash Key: nt2.nt1_id - -> Seq Scan on nt2 - -> Hash - -> Result - -> Seq Scan on nt1 - Optimizer: Pivotal Optimizer (GPORCA) version 3.1.0 -(19 rows) + -> Hash + -> Result + Filter: ((nt2.b1 AND ((NOT (nt1.id IS NULL))))) + -> Result + -> Hash Left Join + Hash Cond: (nt2.nt1_id = nt1.id) + -> Gather Motion 3:1 (slice2; segments: 3) + -> Seq Scan on nt2 + -> Hash + -> Result + -> Gather Motion 3:1 (slice3; segments: 3) + -> Seq Scan on nt1 + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 +(18 rows) select nt3.id from nt3 as nt3 @@ -2958,35 +2957,33 @@ select * from where 1 = (select 1 from int8_tbl t3 where ss.y is not null limit 1) order by 1,2; - QUERY PLAN ------------------------------------------------------------------------------------------------------ - Gather Motion 3:1 (slice3; segments: 3) - Merge Key: int8_tbl.q1, int8_tbl.q2 - -> Sort - Sort Key: int8_tbl.q1, int8_tbl.q2 - -> Result - Filter: (SubPlan 1) - -> Hash Left Join - Hash Cond: (int8_tbl.q2 = int8_tbl_1.q1) - -> Redistribute Motion 3:3 (slice1; segments: 3) - Hash Key: int8_tbl.q2 - -> Seq Scan on int8_tbl - -> Hash - -> Result + QUERY PLAN +-------------------------------------------------------------------------------------------- + Sort + Sort Key: int8_tbl.q1, int8_tbl.q2 + -> Result + Filter: (SubPlan 1) + -> Hash Left Join + Hash Cond: (int8_tbl.q2 = int8_tbl_1.q1) + -> Gather Motion 3:1 (slice1; segments: 3) + -> Seq Scan on int8_tbl + -> Hash + -> Result + -> Gather Motion 3:1 (slice2; segments: 3) -> Seq Scan on int8_tbl int8_tbl_1 - SubPlan 1 (slice3; segments: 3) + SubPlan 1 (slice0) + -> Result -> Result + Filter: (1 = "outer".?column?) -> Result - Filter: (1 = "outer".?column?) - -> Result - -> Limit - -> Result - One-Time Filter: (NOT ("outer".y IS NULL)) - -> Materialize - -> Broadcast Motion 3:3 (slice2; segments: 3) - -> Seq Scan on int8_tbl int8_tbl_2 - Optimizer: Pivotal Optimizer (GPORCA) version 2.74.0 -(26 rows) + -> Limit + -> Result + One-Time Filter: (NOT ("outer".y IS NULL)) + -> Materialize + -> Gather Motion 3:1 (slice3; segments: 3) + -> Seq Scan on int8_tbl int8_tbl_2 + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 +(24 rows) -- -- test case where a PlaceHolderVar is propagated into a subquery @@ -3146,20 +3143,19 @@ where thousand = a.q1 and tenthous = b.q1 and a.q2 = 1 and b.q2 = 2; Gather Motion 3:1 (slice3; segments: 3) -> Hash Join Hash Cond: ((tenk1.thousand)::bigint = int8_tbl_1.q1) - -> Redistribute Motion 3:3 (slice2; segments: 3) - Hash Key: (tenk1.thousand)::bigint - -> Nested Loop - Join Filter: true - -> Broadcast Motion 3:3 (slice1; segments: 3) - -> Seq Scan on int8_tbl - Filter: (q2 = 2) - -> Index Scan using tenk1_thous_tenthous on tenk1 - Index Cond: (tenthous = int8_tbl.q1) + -> Nested Loop + Join Filter: true + -> Broadcast Motion 3:3 (slice1; segments: 3) + -> Seq Scan on int8_tbl + Filter: (q2 = 2) + -> Index Scan using tenk1_thous_tenthous on tenk1 + Index Cond: (tenthous = int8_tbl.q1) -> Hash - -> Seq Scan on int8_tbl int8_tbl_1 - Filter: (q2 = 1) - Optimizer: Pivotal Optimizer (GPORCA) version 3.9.0 -(16 rows) + -> Broadcast Motion 3:3 (slice2; segments: 3) + -> Seq Scan on int8_tbl int8_tbl_1 + Filter: (q2 = 1) + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 +(15 rows) reset enable_nestloop; reset random_page_cost; @@ -3182,39 +3178,35 @@ select t1.unique2, t1.stringu1, t2.unique1, t2.stringu2 from left join tenk1 t2 on (subq1.y1 = t2.unique1) where t1.unique2 < 42 and t1.stringu1 > t2.stringu2; - QUERY PLAN --------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice4; segments: 3) - -> Hash Join - Hash Cond: ("outer".d1 = tenk1_1.unique2) - Join Filter: (tenk1_1.stringu1 > tenk1.stringu2) - -> Redistribute Motion 3:3 (slice2; segments: 3) - Hash Key: "outer".d1 - -> Hash Join - Hash Cond: ("outer".column2 = int4_tbl.f1) - -> Nested Loop - Join Filter: true + QUERY PLAN +-------------------------------------------------------------------------------------------- + Hash Join + Hash Cond: ("outer".d1 = tenk1_1.unique2) + Join Filter: (tenk1_1.stringu1 > tenk1.stringu2) + -> Gather Motion 3:1 (slice2; segments: 3) + -> Hash Join + Hash Cond: ("outer".column2 = int4_tbl.f1) + -> Nested Loop + Join Filter: true + -> Result -> Result -> Result - Filter: ("outer".d1 < 42) - -> Result - -> Hash Left Join - Hash Cond: ("outer".column1 = "outer".column2) + -> Hash Left Join + Hash Cond: ("outer".column1 = "outer".column2) + -> Result + -> Hash -> Result - -> Hash - -> Result - -> Index Scan using tenk1_unique1 on tenk1 - Index Cond: (unique1 = "outer".column1) - -> Hash - -> Broadcast Motion 3:3 (slice1; segments: 3) - -> Seq Scan on int4_tbl - -> Hash - -> Redistribute Motion 3:3 (slice3; segments: 3) - Hash Key: tenk1_1.unique2 - -> Index Scan using tenk1_unique2 on tenk1 tenk1_1 - Index Cond: ((unique2 < 42) AND (unique2 = 11)) - Optimizer: Pivotal Optimizer (GPORCA) version 3.9.0 -(30 rows) + -> Index Scan using tenk1_unique1 on tenk1 + Index Cond: (unique1 = "outer".column1) + -> Hash + -> Broadcast Motion 3:3 (slice1; segments: 3) + -> Seq Scan on int4_tbl + -> Hash + -> Gather Motion 3:1 (slice3; segments: 3) + -> Index Scan using tenk1_unique2 on tenk1 tenk1_1 + Index Cond: ((unique2 < 42) AND (unique2 = 11)) + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 +(27 rows) --end_ignore select t1.unique2, t1.stringu1, t2.unique1, t2.stringu2 from @@ -3716,36 +3708,35 @@ select t1.* from on (i8.q2 = i4.f1); QUERY PLAN ---------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice5; segments: 3) + Gather Motion 3:1 (slice6; segments: 3) Output: text_tbl.f1 -> Hash Left Join Output: text_tbl.f1 Hash Cond: (int8_tbl_1.q2 = (int4_tbl.f1)::bigint) - -> Hash Left Join + -> Redistribute Motion 1:3 (slice4) Output: text_tbl.f1, int8_tbl_1.q2 - Hash Cond: (text_tbl.f1 = "outer".d1) - -> Seq Scan on public.text_tbl - Output: text_tbl.f1 - -> Hash - Output: "outer".d1, int8_tbl_1.q2 - -> Redistribute Motion 3:3 (slice3; segments: 3) + -> Hash Left Join + Output: text_tbl.f1, int8_tbl_1.q2 + Hash Cond: (text_tbl.f1 = "outer".d1) + -> Gather Motion 3:1 (slice1; segments: 3) + Output: text_tbl.f1 + -> Seq Scan on public.text_tbl + Output: text_tbl.f1 + -> Hash Output: "outer".d1, int8_tbl_1.q2 - Hash Key: "outer".d1 -> Hash Left Join Output: "outer".d1, int8_tbl_1.q2 Hash Cond: (int8_tbl.q2 = ("outer".d2)::bigint) -> Result Output: '***'::text, int8_tbl.q2 - -> Redistribute Motion 3:3 (slice1; segments: 3) + -> Gather Motion 3:1 (slice2; segments: 3) Output: int8_tbl.q2 - Hash Key: int8_tbl.q2 -> Seq Scan on public.int8_tbl Output: int8_tbl.q2 -> Hash Output: int8_tbl_1.q2, "outer".d2 - -> Redistribute Motion 3:3 (slice2; segments: 3) + -> Gather Motion 3:1 (slice3; segments: 3) Output: int8_tbl_1.q2, "outer".d2 - Hash Key: ("outer".d2)::bigint -> Hash Left Join Output: int8_tbl_1.q2, "outer".d2 Hash Cond: (int8_tbl_1.q1 = int8_tbl_2.q1) @@ -3759,7 +3750,7 @@ select t1.* from Output: int8_tbl_2.q1 -> Hash Output: int4_tbl.f1 - -> Broadcast Motion 3:3 (slice4; segments: 3) + -> Broadcast Motion 3:3 (slice5; segments: 3) Output: int4_tbl.f1 -> Seq Scan on public.int4_tbl Output: int4_tbl.f1 @@ -3796,36 +3787,35 @@ select t1.* from on (i8.q2 = i4.f1); QUERY PLAN --------------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice6; segments: 3) + Gather Motion 3:1 (slice7; segments: 3) Output: text_tbl.f1 -> Hash Left Join Output: text_tbl.f1 Hash Cond: (int8_tbl_1.q2 = (int4_tbl_1.f1)::bigint) - -> Hash Left Join + -> Redistribute Motion 1:3 (slice5) Output: text_tbl.f1, int8_tbl_1.q2 - Hash Cond: (text_tbl.f1 = "outer".d1) - -> Seq Scan on public.text_tbl - Output: text_tbl.f1 - -> Hash - Output: "outer".d1, int8_tbl_1.q2 - -> Redistribute Motion 3:3 (slice4; segments: 3) + -> Hash Left Join + Output: text_tbl.f1, int8_tbl_1.q2 + Hash Cond: (text_tbl.f1 = "outer".d1) + -> Gather Motion 3:1 (slice1; segments: 3) + Output: text_tbl.f1 + -> Seq Scan on public.text_tbl + Output: text_tbl.f1 + -> Hash Output: "outer".d1, int8_tbl_1.q2 - Hash Key: "outer".d1 -> Hash Left Join Output: "outer".d1, int8_tbl_1.q2 Hash Cond: (int8_tbl.q2 = ("outer".d2)::bigint) -> Result Output: '***'::text, int8_tbl.q2 - -> Redistribute Motion 3:3 (slice1; segments: 3) + -> Gather Motion 3:1 (slice2; segments: 3) Output: int8_tbl.q2 - Hash Key: int8_tbl.q2 -> Seq Scan on public.int8_tbl Output: int8_tbl.q2 -> Hash Output: int8_tbl_1.q2, "outer".d2 - -> Redistribute Motion 3:3 (slice3; segments: 3) + -> Gather Motion 3:1 (slice4; segments: 3) Output: int8_tbl_1.q2, "outer".d2 - Hash Key: ("outer".d2)::bigint -> Hash Left Join Output: int8_tbl_1.q2, "outer".d2 Hash Cond: (int8_tbl_1.q1 = int8_tbl_2.q1) @@ -3841,11 +3831,11 @@ select t1.* from -> Seq Scan on public.int8_tbl int8_tbl_2 Output: int8_tbl_2.q1 -> Materialize - -> Broadcast Motion 3:3 (slice2; segments: 3) + -> Broadcast Motion 3:3 (slice3; segments: 3) -> Seq Scan on public.int4_tbl -> Hash Output: int4_tbl_1.f1 - -> Broadcast Motion 3:3 (slice5; segments: 3) + -> Broadcast Motion 3:3 (slice6; segments: 3) Output: int4_tbl_1.f1 -> Seq Scan on public.int4_tbl int4_tbl_1 Output: int4_tbl_1.f1 @@ -3881,62 +3871,62 @@ select t1.* from on (t1.f1 = b1.d1) left join int4_tbl i4 on (i8.q2 = i4.f1); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice6; segments: 3) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------ + Gather Motion 3:1 (slice8; segments: 3) Output: text_tbl.f1 -> Hash Left Join Output: text_tbl.f1 Hash Cond: (int8_tbl_1.q2 = (int4_tbl_1.f1)::bigint) - -> Hash Left Join + -> Redistribute Motion 1:3 (slice6) Output: text_tbl.f1, int8_tbl_1.q2 - Hash Cond: (text_tbl.f1 = "outer".d1) - -> Seq Scan on public.text_tbl - Output: text_tbl.f1 - -> Hash - Output: "outer".d1, int8_tbl_1.q2 - -> Redistribute Motion 3:3 (slice4; segments: 3) + -> Hash Left Join + Output: text_tbl.f1, int8_tbl_1.q2 + Hash Cond: (text_tbl.f1 = "outer".d1) + -> Gather Motion 3:1 (slice1; segments: 3) + Output: text_tbl.f1 + -> Seq Scan on public.text_tbl + Output: text_tbl.f1 + -> Hash Output: "outer".d1, int8_tbl_1.q2 - Hash Key: "outer".d1 -> Hash Left Join Output: "outer".d1, int8_tbl_1.q2 Hash Cond: (int8_tbl.q2 = ("outer".d2)::bigint) -> Result Output: '***'::text, int8_tbl.q2 - -> Redistribute Motion 3:3 (slice1; segments: 3) + -> Gather Motion 3:1 (slice2; segments: 3) Output: int8_tbl.q2 - Hash Key: int8_tbl.q2 -> Seq Scan on public.int8_tbl Output: int8_tbl.q2 -> Hash Output: int8_tbl_1.q2, "outer".d2 - -> Redistribute Motion 3:3 (slice3; segments: 3) + -> Hash Left Join Output: int8_tbl_1.q2, "outer".d2 - Hash Key: ("outer".d2)::bigint - -> Hash Left Join - Output: int8_tbl_1.q2, "outer".d2 - Hash Cond: (int8_tbl_1.q1 = int8_tbl_2.q1) + Hash Cond: (int8_tbl_1.q1 = int8_tbl_2.q1) + -> Gather Motion 3:1 (slice3; segments: 3) + Output: int8_tbl_1.q1, int8_tbl_1.q2 -> Seq Scan on public.int8_tbl int8_tbl_1 Output: int8_tbl_1.q1, int8_tbl_1.q2 - -> Hash - Output: "outer".d2, int8_tbl_2.q1 - -> Result - Output: NULL::integer, int8_tbl_2.q1 - -> Hash Join + -> Hash + Output: "outer".d2, int8_tbl_2.q1 + -> Result + Output: NULL::integer, int8_tbl_2.q1 + -> Hash Join + Output: int8_tbl_2.q1 + Hash Cond: (int8_tbl_2.q1 = (int4_tbl.f1)::bigint) + -> Gather Motion 3:1 (slice4; segments: 3) Output: int8_tbl_2.q1 - Hash Cond: (int8_tbl_2.q1 = (int4_tbl.f1)::bigint) -> Seq Scan on public.int8_tbl int8_tbl_2 Output: int8_tbl_2.q1 - -> Hash + -> Hash + Output: int4_tbl.f1 + -> Gather Motion 3:1 (slice5; segments: 3) Output: int4_tbl.f1 - -> Redistribute Motion 3:3 (slice2; segments: 3) + -> Seq Scan on public.int4_tbl Output: int4_tbl.f1 - Hash Key: (int4_tbl.f1)::bigint - -> Seq Scan on public.int4_tbl - Output: int4_tbl.f1 -> Hash Output: int4_tbl_1.f1 - -> Broadcast Motion 3:3 (slice5; segments: 3) + -> Broadcast Motion 3:3 (slice7; segments: 3) Output: int4_tbl_1.f1 -> Seq Scan on public.int4_tbl int4_tbl_1 Output: int4_tbl_1.f1 @@ -4167,29 +4157,26 @@ select * from left join (tenk1 as a1 full join (select 1 as id) as yy on (a1.unique1 = yy.id)) on (xx.id = coalesce(yy.id)); - QUERY PLAN ------------------------------------------------------------------- - Gather Motion 3:1 (slice2; segments: 3) - -> Hash Left Join - Hash Cond: (id = COALESCE(id)) + QUERY PLAN +------------------------------------------------------ + Hash Left Join + Hash Cond: (id = COALESCE(id)) + -> Result -> Result - -> Result - -> Result - -> Hash - -> Redistribute Motion 3:3 (slice1; segments: 3) - Hash Key: COALESCE(id) - -> Merge Full Join - Merge Cond: (unique1 = id) - -> Sort - Sort Key: unique1 - -> Seq Scan on tenk1 - -> Sort - Sort Key: id + -> Hash + -> Gather Motion 3:1 (slice1; segments: 3) + -> Merge Full Join + Merge Cond: (unique1 = id) + -> Sort + Sort Key: unique1 + -> Seq Scan on tenk1 + -> Sort + Sort Key: id + -> Result -> Result -> Result - -> Result - Optimizer: Pivotal Optimizer (GPORCA) version 3.44.0 -(20 rows) + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 +(17 rows) select * from (select 1 as id) as xx @@ -4256,31 +4243,27 @@ explain (verbose, costs off) select a.q2, b.q1 from int8_tbl a left join int8_tbl b on a.q2 = coalesce(b.q1, 1) where coalesce(b.q1, 1) > 0; - QUERY PLAN ------------------------------------------------------------------------------ - Gather Motion 3:1 (slice3; segments: 3) + QUERY PLAN +------------------------------------------------------------------------- + Result Output: int8_tbl.q2, int8_tbl_1.q1 - -> Result + Filter: (COALESCE(int8_tbl_1.q1, 1::bigint) > 0) + -> Hash Left Join Output: int8_tbl.q2, int8_tbl_1.q1 - Filter: (COALESCE(int8_tbl_1.q1, 1::bigint) > 0) - -> Hash Left Join - Output: int8_tbl.q2, int8_tbl_1.q1 - Hash Cond: (int8_tbl.q2 = COALESCE(int8_tbl_1.q1, 1::bigint)) - -> Redistribute Motion 3:3 (slice1; segments: 3) + Hash Cond: (int8_tbl.q2 = COALESCE(int8_tbl_1.q1, 1::bigint)) + -> Gather Motion 3:1 (slice1; segments: 3) + Output: int8_tbl.q2 + -> Seq Scan on public.int8_tbl Output: int8_tbl.q2 - Hash Key: int8_tbl.q2 - -> Seq Scan on public.int8_tbl - Output: int8_tbl.q2 - -> Hash + -> Hash + Output: int8_tbl_1.q1 + -> Gather Motion 3:1 (slice2; segments: 3) Output: int8_tbl_1.q1 - -> Redistribute Motion 3:3 (slice2; segments: 3) + -> Seq Scan on public.int8_tbl int8_tbl_1 Output: int8_tbl_1.q1 - Hash Key: COALESCE(int8_tbl_1.q1, 1::bigint) - -> Seq Scan on public.int8_tbl int8_tbl_1 - Output: int8_tbl_1.q1 - Optimizer: Pivotal Optimizer (GPORCA) version 3.9.0 - Settings: enable_hashjoin=off, enable_mergejoin=on, enable_nestloop=off, optimizer=on -(22 rows) + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 + Settings: enable_hashjoin=off, enable_mergejoin=on, enable_nestloop=off +(18 rows) select a.q2, b.q1 from int8_tbl a left join int8_tbl b on a.q2 = coalesce(b.q1, 1) diff --git a/src/test/regress/expected/subselect_gp_optimizer.out b/src/test/regress/expected/subselect_gp_optimizer.out index 50c27e1155..170f1348db 100644 --- a/src/test/regress/expected/subselect_gp_optimizer.out +++ b/src/test/regress/expected/subselect_gp_optimizer.out @@ -718,31 +718,31 @@ select * from csq_pullup t0 where 1= (select count(*) from csq_pullup t1 where t -- numeric, numeric -- explain select * from csq_pullup t0 where 1= (select count(*) from csq_pullup t1 where t0.n=t1.n); - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------- - Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..862.00 rows=1 width=17) - -> Result (cost=0.00..862.00 rows=1 width=17) - Filter: 1 = COALESCE((count((count()))), 0::bigint) - -> Result (cost=0.00..862.00 rows=1 width=36) - -> Hash Left Join (cost=0.00..862.00 rows=1 width=25) - Hash Cond: csq_pullup.n = csq_pullup_1.n - -> Redistribute Motion 3:3 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=17) - Hash Key: csq_pullup.n - -> Seq Scan on csq_pullup (cost=0.00..431.00 rows=1 width=17) - -> Hash (cost=431.00..431.00 rows=1 width=13) - -> GroupAggregate (cost=0.00..431.00 rows=1 width=13) - Group Key: csq_pullup_1.n - -> Sort (cost=0.00..431.00 rows=1 width=13) - Sort Key: csq_pullup_1.n - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..431.00 rows=1 width=13) - Hash Key: csq_pullup_1.n - -> Result (cost=0.00..431.00 rows=1 width=13) - -> GroupAggregate (cost=0.00..431.00 rows=1 width=13) - Group Key: csq_pullup_1.n - -> Sort (cost=0.00..431.00 rows=1 width=5) - Sort Key: csq_pullup_1.n - -> Seq Scan on csq_pullup csq_pullup_1 (cost=0.00..431.00 rows=1 width=5) - Optimizer: Pivotal Optimizer (GPORCA) version 2.74.0 + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------- + Result (cost=0.00..862.00 rows=1 width=17) + Filter: (1 = COALESCE((count((count()))), 0::bigint)) + -> Result (cost=0.00..862.00 rows=1 width=36) + -> Hash Left Join (cost=0.00..862.00 rows=1 width=25) + Hash Cond: (csq_pullup.n = csq_pullup_1.n) + -> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=17) + -> Seq Scan on csq_pullup (cost=0.00..431.00 rows=1 width=17) + -> Hash (cost=431.00..431.00 rows=1 width=13) + -> Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..431.00 rows=1 width=13) + -> Result (cost=0.00..431.00 rows=1 width=13) + -> GroupAggregate (cost=0.00..431.00 rows=1 width=13) + Group Key: csq_pullup_1.n + -> Sort (cost=0.00..431.00 rows=1 width=13) + Sort Key: csq_pullup_1.n + -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..431.00 rows=1 width=13) + Hash Key: csq_pullup_1.n + -> Result (cost=0.00..431.00 rows=1 width=13) + -> GroupAggregate (cost=0.00..431.00 rows=1 width=13) + Group Key: csq_pullup_1.n + -> Sort (cost=0.00..431.00 rows=1 width=5) + Sort Key: csq_pullup_1.n + -> Seq Scan on csq_pullup csq_pullup_1 (cost=0.00..431.00 rows=1 width=5) + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 (23 rows) select * from csq_pullup t0 where 1= (select count(*) from csq_pullup t1 where t0.n=t1.n); @@ -1816,90 +1816,85 @@ SELECT * FROM dedup_test1 INNER JOIN dedup_test2 ON dedup_test1.a= dedup_test2.e -- Test planner to check if it optimizes the join and marks it as a dummy join EXPLAIN SELECT * FROM dedup_test3, dedup_test1 WHERE c = 7 AND dedup_test3.b IN (SELECT b FROM dedup_test1); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Gather Motion 3:1 (slice4; segments: 3) (cost=0.00..1324463.71 rows=4 width=20) - -> Hash Semi Join (cost=0.00..1324463.71 rows=2 width=20) - Hash Cond: dedup_test3.b = dedup_test1_1.b - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..1324032.71 rows=2 width=20) - Hash Key: dedup_test3.b - -> Nested Loop (cost=0.00..1324032.71 rows=2 width=20) - Join Filter: true - -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=12) - -> Sequence (cost=0.00..431.00 rows=1 width=12) - -> Partition Selector for dedup_test3 (dynamic scan id: 1) (cost=10.00..100.00 rows=34 width=4) - Partitions selected: 0 (out of 1) - -> Dynamic Seq Scan on dedup_test3 (dynamic scan id: 1) (cost=0.00..431.00 rows=1 width=12) - Filter: c = 7 - -> Seq Scan on dedup_test1 (cost=0.00..431.00 rows=2 width=8) - -> Hash (cost=431.00..431.00 rows=2 width=4) - -> Redistribute Motion 3:3 (slice3; segments: 3) (cost=0.00..431.00 rows=2 width=4) - Hash Key: dedup_test1_1.b + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------- + Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..1324463.60 rows=4 width=20) + -> Hash Semi Join (cost=0.00..1324463.60 rows=2 width=20) + Hash Cond: (dedup_test3.b = dedup_test1_1.b) + -> Nested Loop (cost=0.00..1324032.60 rows=2 width=20) + Join Filter: true + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=12) + -> Sequence (cost=0.00..431.00 rows=1 width=12) + -> Partition Selector for dedup_test3 (dynamic scan id: 1) (cost=10.00..100.00 rows=34 width=4) + Partitions selected: 0 (out of 1) + -> Dynamic Seq Scan on dedup_test3 (dynamic scan id: 1) (cost=0.00..431.00 rows=1 width=12) + Filter: (c = 7) + -> Seq Scan on dedup_test1 (cost=0.00..431.00 rows=2 width=8) + -> Hash (cost=431.00..431.00 rows=4 width=4) + -> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..431.00 rows=4 width=4) -> Seq Scan on dedup_test1 dedup_test1_1 (cost=0.00..431.00 rows=2 width=4) Optimizer: Pivotal Optimizer (GPORCA) version 2.74.0 (19 rows) EXPLAIN SELECT * FROM dedup_test3, dedup_test1 WHERE c = 7 AND dedup_test3.b IN (SELECT a FROM dedup_test1); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..1324463.71 rows=4 width=20) - -> Hash Semi Join (cost=0.00..1324463.71 rows=2 width=20) - Hash Cond: dedup_test3.b = dedup_test1_1.a - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..1324032.71 rows=2 width=20) - Hash Key: dedup_test3.b - -> Nested Loop (cost=0.00..1324032.71 rows=2 width=20) - Join Filter: true - -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=12) - -> Sequence (cost=0.00..431.00 rows=1 width=12) - -> Partition Selector for dedup_test3 (dynamic scan id: 1) (cost=10.00..100.00 rows=34 width=4) - Partitions selected: 0 (out of 1) - -> Dynamic Seq Scan on dedup_test3 (dynamic scan id: 1) (cost=0.00..431.00 rows=1 width=12) - Filter: c = 7 - -> Seq Scan on dedup_test1 (cost=0.00..431.00 rows=2 width=8) - -> Hash (cost=431.00..431.00 rows=2 width=4) - -> Seq Scan on dedup_test1 dedup_test1_1 (cost=0.00..431.00 rows=2 width=4) - Optimizer: Pivotal Optimizer (GPORCA) version 2.74.0 -(17 rows) + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------- + Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..1324463.60 rows=4 width=20) + -> Hash Semi Join (cost=0.00..1324463.60 rows=2 width=20) + Hash Cond: (dedup_test3.b = dedup_test1_1.a) + -> Nested Loop (cost=0.00..1324032.60 rows=2 width=20) + Join Filter: true + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=12) + -> Sequence (cost=0.00..431.00 rows=1 width=12) + -> Partition Selector for dedup_test3 (dynamic scan id: 1) (cost=10.00..100.00 rows=34 width=4) + Partitions selected: 0 (out of 1) + -> Dynamic Seq Scan on dedup_test3 (dynamic scan id: 1) (cost=0.00..431.00 rows=1 width=12) + Filter: (c = 7) + -> Seq Scan on dedup_test1 (cost=0.00..431.00 rows=2 width=8) + -> Hash (cost=431.00..431.00 rows=4 width=4) + -> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..431.00 rows=4 width=4) + -> Seq Scan on dedup_test1 dedup_test1_1 (cost=0.00..431.00 rows=2 width=4) + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 +(16 rows) EXPLAIN SELECT * FROM dedup_test3, dedup_test1 WHERE c = 7 AND EXISTS (SELECT b FROM dedup_test1) AND dedup_test3.b IN (SELECT b FROM dedup_test1); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Gather Motion 3:1 (slice6; segments: 3) (cost=0.00..2648064.92 rows=4 width=20) - -> Hash Join (cost=0.00..2648064.92 rows=2 width=20) - Hash Cond: dedup_test3.b = dedup_test1_2.b - -> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..1324032.71 rows=2 width=20) - Hash Key: dedup_test3.b - -> Nested Loop (cost=0.00..1324032.71 rows=2 width=20) - Join Filter: true - -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=12) - -> Sequence (cost=0.00..431.00 rows=1 width=12) - -> Partition Selector for dedup_test3 (dynamic scan id: 1) (cost=10.00..100.00 rows=34 width=4) - Partitions selected: 0 (out of 1) - -> Dynamic Seq Scan on dedup_test3 (dynamic scan id: 1) (cost=0.00..431.00 rows=1 width=12) - Filter: c = 7 - -> Seq Scan on dedup_test1 (cost=0.00..431.00 rows=2 width=8) - -> Hash (cost=1324032.22..1324032.22 rows=2 width=4) - -> Nested Loop Semi Join (cost=0.00..1324032.22 rows=2 width=4) - Join Filter: true - -> GroupAggregate (cost=0.00..431.00 rows=2 width=4) - Group Key: dedup_test1_2.b - -> Sort (cost=0.00..431.00 rows=2 width=4) - Sort Key: dedup_test1_2.b - -> Redistribute Motion 3:3 (slice5; segments: 3) (cost=0.00..431.00 rows=2 width=4) - Hash Key: dedup_test1_2.b - -> GroupAggregate (cost=0.00..431.00 rows=2 width=4) - Group Key: dedup_test1_2.b - -> Sort (cost=0.00..431.00 rows=2 width=4) - Sort Key: dedup_test1_2.b - -> Seq Scan on dedup_test1 dedup_test1_2 (cost=0.00..431.00 rows=2 width=4) - -> Materialize (cost=0.00..431.00 rows=1 width=1) - -> Broadcast Motion 1:3 (slice4) (cost=0.00..431.00 rows=3 width=1) - -> Limit (cost=0.00..431.00 rows=1 width=1) - -> Gather Motion 3:1 (slice3; segments: 3) (cost=0.00..431.00 rows=1 width=1) - -> Limit (cost=0.00..431.00 rows=1 width=1) - -> Seq Scan on dedup_test1 dedup_test1_1 (cost=0.00..431.00 rows=2 width=1) - Optimizer: Pivotal Optimizer (GPORCA) version 2.74.0 -(35 rows) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------- + Gather Motion 3:1 (slice6; segments: 3) (cost=0.00..2648064.82 rows=4 width=20) + -> Hash Join (cost=0.00..2648064.81 rows=2 width=20) + Hash Cond: (dedup_test3.b = dedup_test1_2.b) + -> Nested Loop (cost=0.00..1324032.60 rows=2 width=20) + Join Filter: true + -> Broadcast Motion 3:3 (slice1; segments: 3) (cost=0.00..431.00 rows=1 width=12) + -> Sequence (cost=0.00..431.00 rows=1 width=12) + -> Partition Selector for dedup_test3 (dynamic scan id: 1) (cost=10.00..100.00 rows=34 width=4) + Partitions selected: 0 (out of 1) + -> Dynamic Seq Scan on dedup_test3 (dynamic scan id: 1) (cost=0.00..431.00 rows=1 width=12) + Filter: (c = 7) + -> Seq Scan on dedup_test1 (cost=0.00..431.00 rows=2 width=8) + -> Hash (cost=1324032.22..1324032.22 rows=4 width=4) + -> Broadcast Motion 3:3 (slice5; segments: 3) (cost=0.00..1324032.22 rows=4 width=4) + -> Nested Loop Semi Join (cost=0.00..1324032.22 rows=2 width=4) + Join Filter: true + -> GroupAggregate (cost=0.00..431.00 rows=2 width=4) + Group Key: dedup_test1_2.b + -> Sort (cost=0.00..431.00 rows=2 width=4) + Sort Key: dedup_test1_2.b + -> Redistribute Motion 3:3 (slice4; segments: 3) (cost=0.00..431.00 rows=2 width=4) + Hash Key: dedup_test1_2.b + -> GroupAggregate (cost=0.00..431.00 rows=2 width=4) + Group Key: dedup_test1_2.b + -> Sort (cost=0.00..431.00 rows=2 width=4) + Sort Key: dedup_test1_2.b + -> Seq Scan on dedup_test1 dedup_test1_2 (cost=0.00..431.00 rows=2 width=4) + -> Materialize (cost=0.00..431.00 rows=1 width=1) + -> Broadcast Motion 1:3 (slice3) (cost=0.00..431.00 rows=3 width=1) + -> Limit (cost=0.00..431.00 rows=1 width=1) + -> Gather Motion 3:1 (slice2; segments: 3) (cost=0.00..431.00 rows=1 width=1) + -> Limit (cost=0.00..431.00 rows=1 width=1) + -> Seq Scan on dedup_test1 dedup_test1_1 (cost=0.00..431.00 rows=2 width=1) + Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0 +(34 rows) -- start_ignore DROP TABLE IF EXISTS dedup_test1; -- GitLab