postgresql/src/backend/commands
Robert Haas e89a71fb44 Pass InitPlan values to workers via Gather (Merge).
If a PARAM_EXEC parameter is used below a Gather (Merge) but the InitPlan
that computes it is attached to or above the Gather (Merge), force the
value to be computed before starting parallelism and pass it down to all
workers.  This allows us to use parallelism in cases where it previously
would have had to be rejected as unsafe.  We do - in this case - lose the
optimization that the value is only computed if it's actually used.  An
alternative strategy would be to have the first worker that needs the value
compute it, but one downside of that approach is that we'd then need to
select a parallel-safe path to compute the parameter value; it couldn't for
example contain a Gather (Merge) node.  At some point in the future, we
might want to consider both approaches.

Independent of that consideration, there is a great deal more work that
could be done to make more kinds of PARAM_EXEC parameters parallel-safe.
This infrastructure could be used to allow a Gather (Merge) on the inner
side of a nested loop (although that's not a very appealing plan) and
cases where the InitPlan is attached below the Gather (Merge) could be
addressed as well using various techniques.  But this is a good start.

Amit Kapila, reviewed and revised by me.  Reviewing and testing from
Kuntal Ghosh, Haribabu Kommi, and Tushar Ahuja.

Discussion: http://postgr.es/m/CAA4eK1LV0Y1AUV4cUCdC+sYOx0Z0-8NAJ2Pd9=UKsbQ5Sr7+JQ@mail.gmail.com
2017-11-16 12:06:14 -05:00
..
aggregatecmds.c Explicitly track whether aggregate final functions modify transition state. 2017-10-14 15:21:39 -04:00
alter.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
amcmds.c Fix typos in comments. 2017-02-06 11:33:58 +02:00
analyze.c Improve comments in vacuum_rel() and analyze_rel(). 2017-10-05 10:47:47 -04:00
async.c Replace remaining uses of pq_sendint with pq_sendint{8,16,32}. 2017-10-11 21:00:46 -07:00
cluster.c Change tupledesc->attrs[n] to TupleDescAttr(tupledesc, n). 2017-08-20 11:19:07 -07:00
collationcmds.c Don't install ICU collation keyword variants 2017-08-21 19:21:07 -04:00
comment.c Add some const decorations to prototypes 2017-11-10 13:38:57 -05:00
constraint.c Allow index AMs to cache data across aminsert calls within a SQL command. 2017-02-09 11:52:12 -05:00
conversioncmds.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
copy.c Centralize executor-related partitioning code. 2017-11-15 10:26:25 -05:00
createas.c Allow DML commands that create tables to use parallel query. 2017-10-05 11:40:48 -04:00
dbcommands.c Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
define.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
discard.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
dropcmds.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
event_trigger.c Add some const decorations to prototypes 2017-11-10 13:38:57 -05:00
explain.c Pass InitPlan values to workers via Gather (Merge). 2017-11-16 12:06:14 -05:00
extension.c Add some const decorations to prototypes 2017-11-10 13:38:57 -05:00
foreigncmds.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
functioncmds.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
indexcmds.c Simplify index_[constraint_]create API 2017-11-14 15:19:05 +01:00
lockcmds.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
Makefile Implement multivariate n-distinct coefficients 2017-03-24 14:06:10 -03:00
matview.c Change tupledesc->attrs[n] to TupleDescAttr(tupledesc, n). 2017-08-20 11:19:07 -07:00
opclasscmds.c Add some const decorations to prototypes 2017-11-10 13:38:57 -05:00
operatorcmds.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
policy.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
portalcmds.c Remove unnecessary PG_TRY overhead for CurrentResourceOwner changes. 2017-10-11 17:44:09 -04:00
prepare.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
proclang.c Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
publicationcmds.c Message style fixes 2017-09-11 11:21:27 -04:00
schemacmds.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
seclabel.c Reduce excessive dereferencing of function pointers 2017-09-07 13:56:09 -04:00
sequence.c Remove unnecessary PG_TRY overhead for CurrentResourceOwner changes. 2017-10-11 17:44:09 -04:00
statscmds.c Message style fixes 2017-09-11 11:21:27 -04:00
subscriptioncmds.c ... and the very same bug in publicationListToArray(). 2017-09-23 15:16:48 -04:00
tablecmds.c Simplify index_[constraint_]create API 2017-11-14 15:19:05 +01:00
tablespace.c Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
trigger.c Change TRUE/FALSE to true/false 2017-11-08 11:37:28 -05:00
tsearchcmds.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
typecmds.c Add some const decorations to prototypes 2017-11-10 13:38:57 -05:00
user.c Don't allow logging in with empty password. 2017-08-07 17:03:42 +03:00
vacuum.c Improve comments in vacuum_rel() and analyze_rel(). 2017-10-05 10:47:47 -04:00
vacuumlazy.c Revert bogus fixes of HOT-freezing bug 2017-11-02 15:51:41 +01:00
variable.c Remove uses of "slave" in replication contexts 2017-08-10 22:55:41 -04:00
view.c Add some const decorations to prototypes 2017-11-10 13:38:57 -05:00