1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-18 17:42:25 +03:00

Don't consider parallel append for parallel unsafe paths.

Commit ab72716778 allowed Parallel Append paths to be generated for a
relation that is not parallel safe.  Prevent that from happening.

Initial analysis by Tom Lane.

Reported-by: Rajkumar Raghuwanshi
Author: Amit Kapila and Rajkumar Raghuwanshi
Reviewed-by: Amit Khandekar and Robert Haas
Discussion:https://postgr.es/m/CAKcux6=tPJ6nJ08r__nU_pmLQiC0xY15Fn0HvG1Cprsjdd9s_Q@mail.gmail.com
This commit is contained in:
Amit Kapila
2018-06-20 07:51:42 +05:30
parent 1c7c317cd9
commit 403318b71f
3 changed files with 39 additions and 1 deletions

View File

@ -132,6 +132,32 @@ select sp_test_func() order by 1;
foo
(2 rows)
-- Parallel Append is not to be used when the subpath depends on the outer param
create table part_pa_test(a int, b int) partition by range(a);
create table part_pa_test_p1 partition of part_pa_test for values from (minvalue) to (0);
create table part_pa_test_p2 partition of part_pa_test for values from (0) to (maxvalue);
explain (costs off)
select (select max((select pa1.b from part_pa_test pa1 where pa1.a = pa2.a)))
from part_pa_test pa2;
QUERY PLAN
--------------------------------------------------------------
Aggregate
-> Gather
Workers Planned: 3
-> Parallel Append
-> Parallel Seq Scan on part_pa_test_p1 pa2
-> Parallel Seq Scan on part_pa_test_p2 pa2_1
SubPlan 2
-> Result
SubPlan 1
-> Append
-> Seq Scan on part_pa_test_p1 pa1
Filter: (a = pa2.a)
-> Seq Scan on part_pa_test_p2 pa1_1
Filter: (a = pa2.a)
(14 rows)
drop table part_pa_test;
-- test with leader participation disabled
set parallel_leader_participation = off;
explain (costs off)

View File

@ -55,6 +55,15 @@ $$ select 'foo'::varchar union all select 'bar'::varchar $$
language sql stable;
select sp_test_func() order by 1;
-- Parallel Append is not to be used when the subpath depends on the outer param
create table part_pa_test(a int, b int) partition by range(a);
create table part_pa_test_p1 partition of part_pa_test for values from (minvalue) to (0);
create table part_pa_test_p2 partition of part_pa_test for values from (0) to (maxvalue);
explain (costs off)
select (select max((select pa1.b from part_pa_test pa1 where pa1.a = pa2.a)))
from part_pa_test pa2;
drop table part_pa_test;
-- test with leader participation disabled
set parallel_leader_participation = off;
explain (costs off)