Commit d2bc5015 authored by Andres Freund's avatar Andres Freund

Expand coverage of parallel gather merge a bit.

Previously paths reaching heap_compare_slots weren't covered.

Author: Rushabh Lathia
Reviewed-By: Andres Freund
Discussion:
	https://postgr.es/m/CAGPqQf3C+3PBujb+7m=ceWeii4-vBY=XS99LjzrpkpefvzJbFg@mail.gmail.com
	https://postgr.es/m/27200.1502482851@sss.pgh.pa.us
Backpatch: 10, where gather merge was introduced
parent 9f14dc39
...@@ -258,32 +258,73 @@ select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1; ...@@ -258,32 +258,73 @@ select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1;
reset enable_hashjoin; reset enable_hashjoin;
reset enable_nestloop; reset enable_nestloop;
--test gather merge -- test gather merge
set enable_hashagg to off; set enable_hashagg = false;
explain (costs off) explain (costs off)
select string4, count((unique2)) from tenk1 group by string4 order by string4; select count(*) from tenk1 group by twenty;
QUERY PLAN QUERY PLAN
---------------------------------------------------- ----------------------------------------------------
Finalize GroupAggregate Finalize GroupAggregate
Group Key: string4 Group Key: twenty
-> Gather Merge -> Gather Merge
Workers Planned: 4 Workers Planned: 4
-> Partial GroupAggregate -> Partial GroupAggregate
Group Key: string4 Group Key: twenty
-> Sort -> Sort
Sort Key: string4 Sort Key: twenty
-> Parallel Seq Scan on tenk1 -> Parallel Seq Scan on tenk1
(9 rows) (9 rows)
select string4, count((unique2)) from tenk1 group by string4 order by string4; select count(*) from tenk1 group by twenty;
string4 | count count
---------+------- -------
AAAAxx | 2500 500
HHHHxx | 2500 500
OOOOxx | 2500 500
VVVVxx | 2500 500
(4 rows) 500
500
500
500
500
500
500
500
500
500
500
500
500
500
500
500
(20 rows)
-- gather merge test with 0 worker
set max_parallel_workers = 0;
explain (costs off)
select string4 from tenk1 order by string4 limit 5;
QUERY PLAN
----------------------------------------------
Limit
-> Gather Merge
Workers Planned: 4
-> Sort
Sort Key: string4
-> Parallel Seq Scan on tenk1
(6 rows)
select string4 from tenk1 order by string4 limit 5;
string4
---------
AAAAxx
AAAAxx
AAAAxx
AAAAxx
AAAAxx
(5 rows)
reset max_parallel_workers;
reset enable_hashagg; reset enable_hashagg;
set force_parallel_mode=1; set force_parallel_mode=1;
explain (costs off) explain (costs off)
......
...@@ -110,14 +110,20 @@ select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1; ...@@ -110,14 +110,20 @@ select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1;
reset enable_hashjoin; reset enable_hashjoin;
reset enable_nestloop; reset enable_nestloop;
--test gather merge -- test gather merge
set enable_hashagg to off; set enable_hashagg = false;
explain (costs off) explain (costs off)
select string4, count((unique2)) from tenk1 group by string4 order by string4; select count(*) from tenk1 group by twenty;
select string4, count((unique2)) from tenk1 group by string4 order by string4; select count(*) from tenk1 group by twenty;
-- gather merge test with 0 worker
set max_parallel_workers = 0;
explain (costs off)
select string4 from tenk1 order by string4 limit 5;
select string4 from tenk1 order by string4 limit 5;
reset max_parallel_workers;
reset enable_hashagg; reset enable_hashagg;
set force_parallel_mode=1; set force_parallel_mode=1;
......
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