mirror of
https://github.com/postgres/postgres.git
synced 2025-10-16 17:07:43 +03:00
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.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user