diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-08-19 01:13:41 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-08-19 01:13:41 +0000 |
commit | 80860c32d92fe3445dcb7de70091354c9d0406b0 (patch) | |
tree | 2119ed51447a2c45fc75dab13e8ec89115a9890a /src/backend/executor/nodeAgg.c | |
parent | 23e10843db588928e18bd58018c2e70f4548f177 (diff) | |
download | postgresql-80860c32d92fe3445dcb7de70091354c9d0406b0.tar.gz postgresql-80860c32d92fe3445dcb7de70091354c9d0406b0.zip |
Improve dynahash.c's API so that caller can specify the comparison function
as well as the hash function (formerly the comparison function was hardwired
as memcmp()). This makes it possible to eliminate the special-purpose
hashtable management code in execGrouping.c in favor of using dynahash to
manage tuple hashtables; which is a win because dynahash knows how to expand
a hashtable when the original size estimate was too small, whereas the
special-purpose code was too stupid to do that. (See recent gripe from
Stephan Szabo about poor performance when hash table size estimate is way
off.) Free side benefit: when using string_hash, the default comparison
function is now strncmp() instead of memcmp(). This should eliminate some
part of the overhead associated with larger NAMEDATALEN values.
Diffstat (limited to 'src/backend/executor/nodeAgg.c')
-rw-r--r-- | src/backend/executor/nodeAgg.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index d8fb9a9565d..d9adb09dafb 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -45,7 +45,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.115 2003/08/08 21:41:41 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.116 2003/08/19 01:13:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -905,7 +905,7 @@ agg_fill_hash_table(AggState *aggstate) aggstate->table_filled = true; /* Initialize to walk the hash table */ - ResetTupleHashIterator(&aggstate->hashiter); + ResetTupleHashIterator(aggstate->hashtable, &aggstate->hashiter); } /* @@ -920,7 +920,6 @@ agg_retrieve_hash_table(AggState *aggstate) bool *aggnulls; AggStatePerAgg peragg; AggStatePerGroup pergroup; - TupleHashTable hashtable; AggHashEntry entry; TupleTableSlot *firstSlot; TupleTableSlot *resultSlot; @@ -935,7 +934,6 @@ agg_retrieve_hash_table(AggState *aggstate) aggnulls = econtext->ecxt_aggnulls; projInfo = aggstate->ss.ps.ps_ProjInfo; peragg = aggstate->peragg; - hashtable = aggstate->hashtable; firstSlot = aggstate->ss.ss_ScanTupleSlot; /* @@ -950,8 +948,7 @@ agg_retrieve_hash_table(AggState *aggstate) /* * Find the next entry in the hash table */ - entry = (AggHashEntry) ScanTupleHashTable(hashtable, - &aggstate->hashiter); + entry = (AggHashEntry) ScanTupleHashTable(&aggstate->hashiter); if (entry == NULL) { /* No more entries in hashtable, so done */ @@ -1440,7 +1437,7 @@ ExecReScanAgg(AggState *node, ExprContext *exprCtxt) */ if (((PlanState *) node)->lefttree->chgParam == NULL) { - ResetTupleHashIterator(&node->hashiter); + ResetTupleHashIterator(node->hashtable, &node->hashiter); return; } } |