Improve INTERSECT/EXCEPT hashing by realizing that we don't need to make any
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Aug 2008 19:35:02 +0000 (19:35 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Aug 2008 19:35:02 +0000 (19:35 +0000)
commitdc36ce1812b7dff790139df5b82991a54f4fe1d2
tree5731f715852a0f7746d54fa57cfeca0d96cba4e9
parentd6a64c8ec46640d9f26ebeda925b221c239ead00
Improve INTERSECT/EXCEPT hashing by realizing that we don't need to make any
hashtable entries for tuples that are found only in the second input: they
can never contribute to the output.  Furthermore, this implies that the
planner should endeavor to put first the smaller (in number of groups) input
relation for an INTERSECT.  Implement that, and upgrade prepunion's estimation
of the number of rows returned by setops so that there's some amount of sanity
in the estimate of which one is smaller.
src/backend/executor/nodeSetOp.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/outfuncs.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/util/tlist.c
src/include/nodes/plannodes.h
src/include/optimizer/planmain.h
src/include/optimizer/tlist.h