git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 68628fc) | patch
Revise the planner's handling of "pseudoconstant" WHERE clauses, that is
Sat, 1 Jul 2006 18:38:33 +0000 (18:38 +0000)
Sat, 1 Jul 2006 18:38:33 +0000 (18:38 +0000)
commit cffd89ca736e485309cd51ae056f837bd7e683ad
Revise the planner's handling of "pseudoconstant" WHERE clauses, that is
clauses containing no variables and no volatile functions. Such a clause
can be used as a one-time qual in a gating Result plan node, to suppress
plan execution entirely when it is false. Even when the clause is true,
putting it in a gating node wins by avoiding repeated evaluation of the
clause. In previous PG releases, query_planner() would do this for
pseudoconstant clauses appearing at the top level of the jointree, but
there was no ability to generate a gating Result deeper in the plan tree.
To fix it, get rid of the special case in query_planner(), and instead
process pseudoconstant clauses through the normal RestrictInfo qual
distribution mechanism. When a pseudoconstant clause is found attached to
a path node in create_plan(), pull it out and generate a gating Result at
that point. This requires special-casing pseudoconstants in selectivity
estimation and cost_qual_eval, but on the whole it's pretty clean.
It probably even makes the planner a bit faster than before for the normal
case of no pseudoconstants, since removing pull_constant_clauses saves one
useless traversal of the qual tree. Per gripe from Phil Frost.
20 files changed:
src/backend/nodes/copyfuncs.c diff | blob | blame | history
src/backend/nodes/outfuncs.c diff | blob | blame | history
src/backend/optimizer/README diff | blob | blame | history
src/backend/optimizer/path/allpaths.c diff | blob | blame | history
src/backend/optimizer/path/clausesel.c diff | blob | blame | history
src/backend/optimizer/path/costsize.c diff | blob | blame | history
src/backend/optimizer/path/indxpath.c diff | blob | blame | history
src/backend/optimizer/plan/createplan.c diff | blob | blame | history
src/backend/optimizer/plan/initsplan.c diff | blob | blame | history
src/backend/optimizer/plan/planagg.c diff | blob | blame | history
src/backend/optimizer/plan/planmain.c diff | blob | blame | history
src/backend/optimizer/plan/planner.c diff | blob | blame | history
src/backend/optimizer/util/clauses.c diff | blob | blame | history
src/backend/optimizer/util/pathnode.c diff | blob | blame | history
src/backend/optimizer/util/restrictinfo.c diff | blob | blame | history
src/include/nodes/relation.h diff | blob | blame | history
src/include/optimizer/clauses.h diff | blob | blame | history
src/include/optimizer/pathnode.h diff | blob | blame | history
src/include/optimizer/planmain.h diff | blob | blame | history
src/include/optimizer/restrictinfo.h diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /