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/nodes | |
| parent | 368df3042783778031ece2b8580324516cd42de1 (diff) | |
| download | postgresql-af95d7aa63be1d03bad6070d090874d3dfa046e8.tar.gz | |
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/nodes')
| -rw-r--r-- | src/backend/nodes/copyfuncs.c | 3 | ||||
| -rw-r--r-- | src/backend/nodes/outfuncs.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 4767b924e9..90ebd7819a 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.398 2008/08/07 03:04:03 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.399 2008/08/07 19:35:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -657,6 +657,7 @@ _copySetOp(SetOp *from) COPY_POINTER_FIELD(dupColIdx, from->numCols * sizeof(AttrNumber)); COPY_POINTER_FIELD(dupOperators, from->numCols * sizeof(Oid)); COPY_SCALAR_FIELD(flagColIdx); + COPY_SCALAR_FIELD(firstFlag); COPY_SCALAR_FIELD(numGroups); return newnode; diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 8440864b0e..4728117be2 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.332 2008/08/07 03:04:03 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.333 2008/08/07 19:35:02 tgl Exp $ * * NOTES * Every node type that can appear in stored rules' parsetrees *must* @@ -611,6 +611,7 @@ _outSetOp(StringInfo str, SetOp *node) appendStringInfo(str, " %u", node->dupOperators[i]); WRITE_INT_FIELD(flagColIdx); + WRITE_INT_FIELD(firstFlag); WRITE_LONG_FIELD(numGroups); } |
