postgresql/src/include/optimizer
Tom Lane 9f2ee8f287 Re-implement EvalPlanQual processing to improve its performance and eliminate
a lot of strange behaviors that occurred in join cases.  We now identify the
"current" row for every joined relation in UPDATE, DELETE, and SELECT FOR
UPDATE/SHARE queries.  If an EvalPlanQual recheck is necessary, we jam the
appropriate row into each scan node in the rechecking plan, forcing it to emit
only that one row.  The former behavior could rescan the whole of each joined
relation for each recheck, which was terrible for performance, and what's much
worse could result in duplicated output tuples.

Also, the original implementation of EvalPlanQual could not re-use the recheck
execution tree --- it had to go through a full executor init and shutdown for
every row to be tested.  To avoid this overhead, I've associated a special
runtime Param with each LockRows or ModifyTable plan node, and arranged to
make every scan node below such a node depend on that Param.  Thus, by
signaling a change in that Param, the EPQ machinery can just rescan the
already-built test plan.

This patch also adds a prohibition on set-returning functions in the
targetlist of SELECT FOR UPDATE/SHARE.  This is needed to avoid the
duplicate-output-tuple problem.  It seems fairly reasonable since the
other restrictions on SELECT FOR UPDATE are meant to ensure that there
is a unique correspondence between source tuples and result tuples,
which an output SRF destroys as much as anything else does.
2009-10-26 02:26:45 +00:00
..
clauses.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
cost.h Rewrite the planner's handling of materialized plan types so that there is 2009-09-12 22:12:09 +00:00
geqo_copy.h Make GEQO's planning deterministic by having it start from a predictable 2009-07-16 20:55:44 +00:00
geqo_gene.h
geqo_misc.h
geqo_mutation.h Make GEQO's planning deterministic by having it start from a predictable 2009-07-16 20:55:44 +00:00
geqo_pool.h Make GEQO's planning deterministic by having it start from a predictable 2009-07-16 20:55:44 +00:00
geqo_random.h Make GEQO's planning deterministic by having it start from a predictable 2009-07-16 20:55:44 +00:00
geqo_recombination.h Make GEQO's planning deterministic by having it start from a predictable 2009-07-16 20:55:44 +00:00
geqo_selection.h Make GEQO's planning deterministic by having it start from a predictable 2009-07-16 20:55:44 +00:00
geqo.h Make GEQO's planning deterministic by having it start from a predictable 2009-07-16 20:55:44 +00:00
joininfo.h
pathnode.h Implement "join removal" for cases where the inner side of a left join 2009-09-17 20:49:29 +00:00
paths.h Implement "join removal" for cases where the inner side of a left join 2009-09-17 20:49:29 +00:00
placeholder.h 8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list 2009-06-11 14:49:15 +00:00
plancat.h Make backend header files C++ safe 2009-07-16 06:33:46 +00:00
planmain.h Re-implement EvalPlanQual processing to improve its performance and eliminate 2009-10-26 02:26:45 +00:00
planner.h
predtest.h
prep.h Re-implement EvalPlanQual processing to improve its performance and eliminate 2009-10-26 02:26:45 +00:00
restrictinfo.h Fix set_append_rel_pathlist() to deal intelligently with cases where 2009-07-06 18:26:30 +00:00
subselect.h Re-implement EvalPlanQual processing to improve its performance and eliminate 2009-10-26 02:26:45 +00:00
tlist.h
var.h Fix estimate_num_groups() to not fail on PlaceHolderVars, per report from 2009-04-19 19:46:33 +00:00