summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2017-08-14 15:21:26 -0700
committerAndres Freund <andres@anarazel.de>2017-08-14 15:27:48 -0700
commitee5572e051955ef4570f95413dc6cddb4df51d50 (patch)
tree07642db0d95a782e2443d72e199c3f7132e2a4fb
parent21d304dfedb4f26d0d6587d9ac39b1b5c499bb55 (diff)
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
-rw-r--r--src/test/regress/expected/select_parallel.out69
-rw-r--r--src/test/regress/sql/select_parallel.sql14
2 files changed, 65 insertions, 18 deletions
diff --git a/src/test/regress/expected/select_parallel.out b/src/test/regress/expected/select_parallel.out
index 3e35e96c4b3..0efb211c970 100644
--- a/src/test/regress/expected/select_parallel.out
+++ b/src/test/regress/expected/select_parallel.out
@@ -258,32 +258,73 @@ select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1;
reset enable_hashjoin;
reset enable_nestloop;
---test gather merge
-set enable_hashagg to off;
+-- test gather merge
+set enable_hashagg = false;
explain (costs off)
- select string4, count((unique2)) from tenk1 group by string4 order by string4;
+ select count(*) from tenk1 group by twenty;
QUERY PLAN
----------------------------------------------------
Finalize GroupAggregate
- Group Key: string4
+ Group Key: twenty
-> Gather Merge
Workers Planned: 4
-> Partial GroupAggregate
- Group Key: string4
+ Group Key: twenty
-> Sort
- Sort Key: string4
+ Sort Key: twenty
-> Parallel Seq Scan on tenk1
(9 rows)
-select string4, count((unique2)) from tenk1 group by string4 order by string4;
- string4 | count
----------+-------
- AAAAxx | 2500
- HHHHxx | 2500
- OOOOxx | 2500
- VVVVxx | 2500
-(4 rows)
+select count(*) from tenk1 group by twenty;
+ count
+-------
+ 500
+ 500
+ 500
+ 500
+ 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;
set force_parallel_mode=1;
explain (costs off)
diff --git a/src/test/regress/sql/select_parallel.sql b/src/test/regress/sql/select_parallel.sql
index d2d262c7249..e717f92e530 100644
--- a/src/test/regress/sql/select_parallel.sql
+++ b/src/test/regress/sql/select_parallel.sql
@@ -110,14 +110,20 @@ select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1;
reset enable_hashjoin;
reset enable_nestloop;
---test gather merge
-set enable_hashagg to off;
+-- test gather merge
+set enable_hashagg = false;
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;
set force_parallel_mode=1;