|
|
|
@ -34,6 +34,49 @@ select count(*) from a_star; |
|
|
|
|
50 |
|
|
|
|
(1 row) |
|
|
|
|
|
|
|
|
|
-- test with leader participation disabled |
|
|
|
|
set parallel_leader_participation = off; |
|
|
|
|
explain (costs off) |
|
|
|
|
select count(*) from tenk1 where stringu1 = 'GRAAAA'; |
|
|
|
|
QUERY PLAN |
|
|
|
|
--------------------------------------------------------- |
|
|
|
|
Finalize Aggregate |
|
|
|
|
-> Gather |
|
|
|
|
Workers Planned: 4 |
|
|
|
|
-> Partial Aggregate |
|
|
|
|
-> Parallel Seq Scan on tenk1 |
|
|
|
|
Filter: (stringu1 = 'GRAAAA'::name) |
|
|
|
|
(6 rows) |
|
|
|
|
|
|
|
|
|
select count(*) from tenk1 where stringu1 = 'GRAAAA'; |
|
|
|
|
count |
|
|
|
|
------- |
|
|
|
|
15 |
|
|
|
|
(1 row) |
|
|
|
|
|
|
|
|
|
-- test with leader participation disabled, but no workers available (so |
|
|
|
|
-- the leader will have to run the plan despite the setting) |
|
|
|
|
set max_parallel_workers = 0; |
|
|
|
|
explain (costs off) |
|
|
|
|
select count(*) from tenk1 where stringu1 = 'GRAAAA'; |
|
|
|
|
QUERY PLAN |
|
|
|
|
--------------------------------------------------------- |
|
|
|
|
Finalize Aggregate |
|
|
|
|
-> Gather |
|
|
|
|
Workers Planned: 4 |
|
|
|
|
-> Partial Aggregate |
|
|
|
|
-> Parallel Seq Scan on tenk1 |
|
|
|
|
Filter: (stringu1 = 'GRAAAA'::name) |
|
|
|
|
(6 rows) |
|
|
|
|
|
|
|
|
|
select count(*) from tenk1 where stringu1 = 'GRAAAA'; |
|
|
|
|
count |
|
|
|
|
------- |
|
|
|
|
15 |
|
|
|
|
(1 row) |
|
|
|
|
|
|
|
|
|
reset max_parallel_workers; |
|
|
|
|
reset parallel_leader_participation; |
|
|
|
|
-- test that parallel_restricted function doesn't run in worker |
|
|
|
|
alter table tenk1 set (parallel_workers = 4); |
|
|
|
|
explain (verbose, costs off) |
|
|
|
@ -400,6 +443,49 @@ explain (costs off, verbose) |
|
|
|
|
(11 rows) |
|
|
|
|
|
|
|
|
|
drop function simple_func(integer); |
|
|
|
|
-- test gather merge with parallel leader participation disabled |
|
|
|
|
set parallel_leader_participation = off; |
|
|
|
|
explain (costs off) |
|
|
|
|
select count(*) from tenk1 group by twenty; |
|
|
|
|
QUERY PLAN |
|
|
|
|
---------------------------------------------------- |
|
|
|
|
Finalize GroupAggregate |
|
|
|
|
Group Key: twenty |
|
|
|
|
-> Gather Merge |
|
|
|
|
Workers Planned: 4 |
|
|
|
|
-> Partial GroupAggregate |
|
|
|
|
Group Key: twenty |
|
|
|
|
-> Sort |
|
|
|
|
Sort Key: twenty |
|
|
|
|
-> Parallel Seq Scan on tenk1 |
|
|
|
|
(9 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) |
|
|
|
|
|
|
|
|
|
reset parallel_leader_participation; |
|
|
|
|
--test rescan behavior of gather merge |
|
|
|
|
set enable_material = false; |
|
|
|
|
explain (costs off) |
|
|
|
@ -508,6 +594,33 @@ select string4 from tenk1 order by string4 limit 5; |
|
|
|
|
AAAAxx |
|
|
|
|
(5 rows) |
|
|
|
|
|
|
|
|
|
-- gather merge test with 0 workers, with parallel leader |
|
|
|
|
-- participation disabled (the leader will have to run the plan |
|
|
|
|
-- despite the setting) |
|
|
|
|
set parallel_leader_participation = off; |
|
|
|
|
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 parallel_leader_participation; |
|
|
|
|
reset max_parallel_workers; |
|
|
|
|
SAVEPOINT settings; |
|
|
|
|
SET LOCAL force_parallel_mode = 1; |
|
|
|
|