src/backend/executor/nodeHash.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index 906cb46..63d484c 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -388,7 +388,9 @@ ExecHashTableCreate(Hash *node, List *hashOperators, bool keepNulls) MemoryContextSwitchTo(hashtable->batchCxt); hashtable->buckets = (HashJoinTuple *) - palloc0(nbuckets * sizeof(HashJoinTuple)); + MemoryContextAllocHuge(hashtable->batchCxt, + nbuckets * sizeof(HashJoinTuple)); + memset(hashtable->buckets, 0, nbuckets * sizeof(HashJoinTuple)); /* * Set up for skew optimization, if possible and there's a need for more @@ -654,7 +656,7 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable) hashtable->nbuckets = hashtable->nbuckets_optimal; hashtable->log2_nbuckets = hashtable->log2_nbuckets_optimal; - hashtable->buckets = repalloc(hashtable->buckets, + hashtable->buckets = repalloc_huge(hashtable->buckets, sizeof(HashJoinTuple) * hashtable->nbuckets); } @@ -779,7 +781,7 @@ ExecHashIncreaseNumBuckets(HashJoinTable hashtable) * chunks) */ hashtable->buckets = - (HashJoinTuple *) repalloc(hashtable->buckets, + (HashJoinTuple *) repalloc_huge(hashtable->buckets, hashtable->nbuckets * sizeof(HashJoinTuple)); memset(hashtable->buckets, 0, sizeof(void *) * hashtable->nbuckets); @@ -1217,7 +1219,9 @@ ExecHashTableReset(HashJoinTable hashtable) /* Reallocate and reinitialize the hash bucket headers. */ hashtable->buckets = (HashJoinTuple *) - palloc0(nbuckets * sizeof(HashJoinTuple)); + MemoryContextAllocHuge(hashtable->batchCxt, + nbuckets * sizeof(HashJoinTuple)); + memset(hashtable->buckets, 0, sizeof(nbuckets * sizeof(HashJoinTuple))); hashtable->spaceUsed = 0;