aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeSetOp.c
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2025-01-13 14:14:07 -0800
committerJeff Davis <jdavis@postgresql.org>2025-01-13 14:14:33 -0800
commitb4a07f532b40a64fb4714a3f7ab6063435411edb (patch)
tree0b46b6e5213ca51b3516e823af4c6864ae55d604 /src/backend/executor/nodeSetOp.c
parentaf2317652d5daf8b382cc65936731c4a3c0aaa4c (diff)
downloadpostgresql-b4a07f532b40a64fb4714a3f7ab6063435411edb.tar.gz
postgresql-b4a07f532b40a64fb4714a3f7ab6063435411edb.zip
Revert "TupleHashTable: store additional data along with tuple."
This reverts commit e0ece2a981ee9068f50c4423e303836c2585eb02 due to performance regressions. Reported-by: David Rowley
Diffstat (limited to 'src/backend/executor/nodeSetOp.c')
-rw-r--r--src/backend/executor/nodeSetOp.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/backend/executor/nodeSetOp.c b/src/backend/executor/nodeSetOp.c
index 2a50d56fc87..5b7ff9c3748 100644
--- a/src/backend/executor/nodeSetOp.c
+++ b/src/backend/executor/nodeSetOp.c
@@ -425,7 +425,6 @@ setop_fill_hash_table(SetOpState *setopstate)
{
TupleTableSlot *outerslot;
TupleHashEntryData *entry;
- SetOpStatePerGroup pergroup;
bool isnew;
outerslot = ExecProcNode(outerPlan);
@@ -438,16 +437,16 @@ setop_fill_hash_table(SetOpState *setopstate)
outerslot,
&isnew, NULL);
- pergroup = TupleHashEntryGetAdditional(entry);
/* If new tuple group, initialize counts to zero */
if (isnew)
{
- pergroup->numLeft = 0;
- pergroup->numRight = 0;
+ entry->additional = (SetOpStatePerGroup)
+ MemoryContextAllocZero(setopstate->hashtable->tablecxt,
+ sizeof(SetOpStatePerGroupData));
}
/* Advance the counts */
- pergroup->numLeft++;
+ ((SetOpStatePerGroup) entry->additional)->numLeft++;
/* Must reset expression context after each hashtable lookup */
ResetExprContext(econtext);
@@ -479,7 +478,7 @@ setop_fill_hash_table(SetOpState *setopstate)
/* Advance the counts if entry is already present */
if (entry)
- ((SetOpStatePerGroup) TupleHashEntryGetAdditional(entry))->numRight++;
+ ((SetOpStatePerGroup) entry->additional)->numRight++;
/* Must reset expression context after each hashtable lookup */
ResetExprContext(econtext);
@@ -497,7 +496,7 @@ setop_fill_hash_table(SetOpState *setopstate)
static TupleTableSlot *
setop_retrieve_hash_table(SetOpState *setopstate)
{
- TupleHashEntry entry;
+ TupleHashEntryData *entry;
TupleTableSlot *resultTupleSlot;
/*
@@ -527,12 +526,12 @@ setop_retrieve_hash_table(SetOpState *setopstate)
* See if we should emit any copies of this tuple, and if so return
* the first copy.
*/
- set_output_count(setopstate, (SetOpStatePerGroup) TupleHashEntryGetAdditional(entry));
+ set_output_count(setopstate, (SetOpStatePerGroup) entry->additional);
if (setopstate->numOutput > 0)
{
setopstate->numOutput--;
- return ExecStoreMinimalTuple(TupleHashEntryGetTuple(entry),
+ return ExecStoreMinimalTuple(entry->firstTuple,
resultTupleSlot,
false);
}