Forbid parallel Hash Right Join or Hash Full Join
This commit is contained in:
@ -1805,7 +1805,8 @@ static void hash_inner_and_outer(PlannerInfo* root, RelOptInfo* joinrel, RelOptI
|
|||||||
* able to properly guarantee uniqueness. Also, the resulting path
|
* able to properly guarantee uniqueness. Also, the resulting path
|
||||||
* must not be parameterized.
|
* must not be parameterized.
|
||||||
*/
|
*/
|
||||||
if (joinrel->consider_parallel && jointype != JOIN_UNIQUE_OUTER && outerrel->partial_pathlist != NIL) {
|
if (joinrel->consider_parallel && jointype != JOIN_UNIQUE_OUTER && jointype != JOIN_FULL &&
|
||||||
|
jointype != JOIN_RIGHT && outerrel->partial_pathlist != NIL) {
|
||||||
Path* cheapest_partial_outer;
|
Path* cheapest_partial_outer;
|
||||||
Path* cheapest_safe_inner = NULL;
|
Path* cheapest_safe_inner = NULL;
|
||||||
|
|
||||||
|
@ -29,12 +29,10 @@ select * from parallel_hashjoin_test_a left outer join parallel_hashjoin_test_b
|
|||||||
9 | 9
|
9 | 9
|
||||||
(9 rows)
|
(9 rows)
|
||||||
|
|
||||||
|
|
||||||
set parallel_setup_cost = 1;
|
set parallel_setup_cost = 1;
|
||||||
set min_parallel_table_scan_size=0;
|
set min_parallel_table_scan_size=0;
|
||||||
set parallel_tuple_cost = 0.01;
|
set parallel_tuple_cost = 0.01;
|
||||||
set enable_nestloop=off;
|
set enable_nestloop=off;
|
||||||
|
|
||||||
explain (costs off) select * from parallel_hashjoin_test_a left outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id where parallel_hashjoin_test_a.id < 10;
|
explain (costs off) select * from parallel_hashjoin_test_a left outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id where parallel_hashjoin_test_a.id < 10;
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
@ -62,9 +60,33 @@ select * from parallel_hashjoin_test_a left outer join parallel_hashjoin_test_b
|
|||||||
9 | 9
|
9 | 9
|
||||||
(9 rows)
|
(9 rows)
|
||||||
|
|
||||||
|
-- Forbid parallel Hash Right Join or Hash Full Join.
|
||||||
|
explain (costs off)select * from parallel_hashjoin_test_a right outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id;
|
||||||
|
QUERY PLAN
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
Hash Right Join
|
||||||
|
Hash Cond: (parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id)
|
||||||
|
-> Seq Scan on parallel_hashjoin_test_a
|
||||||
|
-> Hash
|
||||||
|
-> Seq Scan on parallel_hashjoin_test_b
|
||||||
|
(5 rows)
|
||||||
|
|
||||||
|
select * from parallel_hashjoin_test_a right outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id;
|
||||||
|
id | id
|
||||||
|
----+----
|
||||||
|
1 | 1
|
||||||
|
2 | 2
|
||||||
|
3 | 3
|
||||||
|
4 | 4
|
||||||
|
5 | 5
|
||||||
|
6 | 6
|
||||||
|
7 | 7
|
||||||
|
8 | 8
|
||||||
|
9 | 9
|
||||||
|
10 | 10
|
||||||
|
(10 rows)
|
||||||
|
|
||||||
reset parallel_setup_cost;
|
reset parallel_setup_cost;
|
||||||
reset min_parallel_table_scan_size;
|
reset min_parallel_table_scan_size;
|
||||||
reset parallel_tuple_cost;
|
reset parallel_tuple_cost;
|
||||||
reset enable_nestloop;
|
reset enable_nestloop;
|
||||||
|
|
||||||
|
@ -1,22 +1,25 @@
|
|||||||
create table parallel_hashjoin_test_a (id int);
|
create table parallel_hashjoin_test_a (id int);
|
||||||
create table parallel_hashjoin_test_b (id int);
|
create table parallel_hashjoin_test_b (id int);
|
||||||
insert into parallel_hashjoin_test_a select n from generate_series(1,1000) n;
|
insert into parallel_hashjoin_test_a select n from generate_series(1,1000) n;
|
||||||
insert into parallel_hashjoin_test_b select n from generate_series(1,10) n;
|
insert into parallel_hashjoin_test_b select n from generate_series(1,10) n;
|
||||||
analyse parallel_hashjoin_test_a;
|
analyse parallel_hashjoin_test_a;
|
||||||
analyse parallel_hashjoin_test_b;
|
analyse parallel_hashjoin_test_b;
|
||||||
explain (costs off) select * from parallel_hashjoin_test_a left outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id where parallel_hashjoin_test_a.id < 10;
|
explain (costs off) select * from parallel_hashjoin_test_a left outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id where parallel_hashjoin_test_a.id < 10;
|
||||||
select * from parallel_hashjoin_test_a left outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id where parallel_hashjoin_test_a.id < 10;
|
select * from parallel_hashjoin_test_a left outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id where parallel_hashjoin_test_a.id < 10;
|
||||||
|
|
||||||
set parallel_setup_cost = 1;
|
set parallel_setup_cost = 1;
|
||||||
set min_parallel_table_scan_size=0;
|
set min_parallel_table_scan_size=0;
|
||||||
set parallel_tuple_cost = 0.01;
|
set parallel_tuple_cost = 0.01;
|
||||||
set enable_nestloop=off;
|
set enable_nestloop=off;
|
||||||
|
|
||||||
explain (costs off) select * from parallel_hashjoin_test_a left outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id where parallel_hashjoin_test_a.id < 10;
|
explain (costs off) select * from parallel_hashjoin_test_a left outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id where parallel_hashjoin_test_a.id < 10;
|
||||||
select * from parallel_hashjoin_test_a left outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id where parallel_hashjoin_test_a.id < 10;
|
select * from parallel_hashjoin_test_a left outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id where parallel_hashjoin_test_a.id < 10;
|
||||||
|
-- Forbid parallel Hash Right Join or Hash Full Join.
|
||||||
reset parallel_setup_cost;
|
explain (costs off)select * from parallel_hashjoin_test_a right outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id;
|
||||||
reset min_parallel_table_scan_size;
|
select * from parallel_hashjoin_test_a right outer join parallel_hashjoin_test_b on parallel_hashjoin_test_a.id = parallel_hashjoin_test_b.id;
|
||||||
reset parallel_tuple_cost;
|
|
||||||
reset enable_nestloop;
|
reset parallel_setup_cost;
|
||||||
|
reset min_parallel_table_scan_size;
|
||||||
|
reset parallel_tuple_cost;
|
||||||
|
reset enable_nestloop;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user