diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-08-07 19:35:02 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-08-07 19:35:02 +0000 |
commit | af95d7aa63be1d03bad6070d090874d3dfa046e8 (patch) | |
tree | 8466da3dda219225c516bf87fc521b5ccc86f91c /src/backend/optimizer/plan/createplan.c | |
parent | 368df3042783778031ece2b8580324516cd42de1 (diff) | |
download | postgresql-af95d7aa63be1d03bad6070d090874d3dfa046e8.tar.gz postgresql-af95d7aa63be1d03bad6070d090874d3dfa046e8.zip |
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.
Diffstat (limited to 'src/backend/optimizer/plan/createplan.c')
-rw-r--r-- | src/backend/optimizer/plan/createplan.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 4cf2a5208b1..0c200e05795 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.243 2008/08/07 03:04:03 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.244 2008/08/07 19:35:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -3109,8 +3109,8 @@ make_unique(Plan *lefttree, List *distinctList) */ SetOp * make_setop(SetOpCmd cmd, SetOpStrategy strategy, Plan *lefttree, - List *distinctList, AttrNumber flagColIdx, long numGroups, - double outputRows) + List *distinctList, AttrNumber flagColIdx, int firstFlag, + long numGroups, double outputRows) { SetOp *node = makeNode(SetOp); Plan *plan = &node->plan; @@ -3159,6 +3159,7 @@ make_setop(SetOpCmd cmd, SetOpStrategy strategy, Plan *lefttree, node->dupColIdx = dupColIdx; node->dupOperators = dupOperators; node->flagColIdx = flagColIdx; + node->firstFlag = firstFlag; node->numGroups = numGroups; return node; |