Commit 3bc7dafa authored by Robert Haas's avatar Robert Haas

Consider parallel merge joins.

Commit 45be99f8 took the position
that performing a merge join in parallel was not likely to work out
well, but this conclusion was greeted with skepticism even at the
time.  Whether it was true then or not, it's clearly not true any
more now that we have parallel index scan.

Dilip Kumar, reviewed by Amit Kapila and by me.

Discussion: http://postgr.es/m/CAFiTN-v3=cM6nyFwFGp0fmvY4=kk79Hq9Fgu0u8CSJ-EEq1Tiw@mail.gmail.com
parent ef266239
This diff is collapsed.
...@@ -169,6 +169,31 @@ select count(*) from tenk1 where thousand > 95; ...@@ -169,6 +169,31 @@ select count(*) from tenk1 where thousand > 95;
reset enable_seqscan; reset enable_seqscan;
reset enable_bitmapscan; reset enable_bitmapscan;
-- test parallel merge join path.
set enable_hashjoin to off;
set enable_nestloop to off;
explain (costs off)
select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1;
QUERY PLAN
-------------------------------------------------------------------------------
Finalize Aggregate
-> Gather
Workers Planned: 4
-> Partial Aggregate
-> Merge Join
Merge Cond: (tenk1.unique1 = tenk2.unique1)
-> Parallel Index Only Scan using tenk1_unique1 on tenk1
-> Index Only Scan using tenk2_unique1 on tenk2
(8 rows)
select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1;
count
-------
10000
(1 row)
reset enable_hashjoin;
reset enable_nestloop;
set force_parallel_mode=1; set force_parallel_mode=1;
explain (costs off) explain (costs off)
select stringu1::int2 from tenk1 where unique1 = 1; select stringu1::int2 from tenk1 where unique1 = 1;
......
...@@ -64,6 +64,16 @@ select count(*) from tenk1 where thousand > 95; ...@@ -64,6 +64,16 @@ select count(*) from tenk1 where thousand > 95;
reset enable_seqscan; reset enable_seqscan;
reset enable_bitmapscan; reset enable_bitmapscan;
-- test parallel merge join path.
set enable_hashjoin to off;
set enable_nestloop to off;
explain (costs off)
select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1;
select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1;
reset enable_hashjoin;
reset enable_nestloop;
set force_parallel_mode=1; set force_parallel_mode=1;
explain (costs off) explain (costs off)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment