mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Try again to fix the way the scanjoin_target is used with partial paths.
Commit 04ae11f62e
removed some broken
code to apply the scan/join target to partial paths, but its theory
that this processing step is totally unnecessary turns out to be wrong.
Put similar code back again, but this time, check for parallel-safety
and avoid in-place modifications to paths that may already have been
used as part of some other path.
(This is not an entirely elegant solution to this problem; it might
be better, for example, to postpone generate_gather_paths for the
topmost scan/join rel until after the scan/join target has been
applied. But this is not the time for such redesign work.)
Amit Kapila and Robert Haas
This commit is contained in:
@ -51,6 +51,38 @@ select parallel_restricted(unique1) from tenk1
|
||||
Filter: (tenk1.stringu1 = 'GRAAAA'::name)
|
||||
(9 rows)
|
||||
|
||||
-- test parallel plan when group by expression is in target list.
|
||||
explain (costs off)
|
||||
select length(stringu1) from tenk1 group by length(stringu1);
|
||||
QUERY PLAN
|
||||
---------------------------------------------------
|
||||
Finalize HashAggregate
|
||||
Group Key: (length((stringu1)::text))
|
||||
-> Gather
|
||||
Workers Planned: 4
|
||||
-> Partial HashAggregate
|
||||
Group Key: length((stringu1)::text)
|
||||
-> Parallel Seq Scan on tenk1
|
||||
(7 rows)
|
||||
|
||||
select length(stringu1) from tenk1 group by length(stringu1);
|
||||
length
|
||||
--------
|
||||
6
|
||||
(1 row)
|
||||
|
||||
-- test that parallel plan for aggregates is not selected when
|
||||
-- target list contains parallel restricted clause.
|
||||
explain (costs off)
|
||||
select sum(parallel_restricted(unique1)) from tenk1
|
||||
group by(parallel_restricted(unique1));
|
||||
QUERY PLAN
|
||||
----------------------------------------------------
|
||||
HashAggregate
|
||||
Group Key: parallel_restricted(unique1)
|
||||
-> Index Only Scan using tenk1_unique1 on tenk1
|
||||
(3 rows)
|
||||
|
||||
set force_parallel_mode=1;
|
||||
explain (costs off)
|
||||
select stringu1::int2 from tenk1 where unique1 = 1;
|
||||
|
@ -24,6 +24,17 @@ explain (verbose, costs off)
|
||||
select parallel_restricted(unique1) from tenk1
|
||||
where stringu1 = 'GRAAAA' order by 1;
|
||||
|
||||
-- test parallel plan when group by expression is in target list.
|
||||
explain (costs off)
|
||||
select length(stringu1) from tenk1 group by length(stringu1);
|
||||
select length(stringu1) from tenk1 group by length(stringu1);
|
||||
|
||||
-- test that parallel plan for aggregates is not selected when
|
||||
-- target list contains parallel restricted clause.
|
||||
explain (costs off)
|
||||
select sum(parallel_restricted(unique1)) from tenk1
|
||||
group by(parallel_restricted(unique1));
|
||||
|
||||
set force_parallel_mode=1;
|
||||
|
||||
explain (costs off)
|
||||
|
Reference in New Issue
Block a user