Rename another "hash_mem" local variable.
Missed by my commit 564ce621. Backpatch: 13-, where disk-based hash aggregation was introduced.
This commit is contained in:
parent
b6c15e71f3
commit
cdd7bd695b
@ -1839,15 +1839,15 @@ hash_agg_check_limits(AggState *aggstate)
|
|||||||
uint64 ngroups = aggstate->hash_ngroups_current;
|
uint64 ngroups = aggstate->hash_ngroups_current;
|
||||||
Size meta_mem = MemoryContextMemAllocated(aggstate->hash_metacxt,
|
Size meta_mem = MemoryContextMemAllocated(aggstate->hash_metacxt,
|
||||||
true);
|
true);
|
||||||
Size hash_mem = MemoryContextMemAllocated(aggstate->hashcontext->ecxt_per_tuple_memory,
|
Size hashkey_mem = MemoryContextMemAllocated(aggstate->hashcontext->ecxt_per_tuple_memory,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't spill unless there's at least one group in the hash table so we
|
* Don't spill unless there's at least one group in the hash table so we
|
||||||
* can be sure to make progress even in edge cases.
|
* can be sure to make progress even in edge cases.
|
||||||
*/
|
*/
|
||||||
if (aggstate->hash_ngroups_current > 0 &&
|
if (aggstate->hash_ngroups_current > 0 &&
|
||||||
(meta_mem + hash_mem > aggstate->hash_mem_limit ||
|
(meta_mem + hashkey_mem > aggstate->hash_mem_limit ||
|
||||||
ngroups > aggstate->hash_ngroups_limit))
|
ngroups > aggstate->hash_ngroups_limit))
|
||||||
{
|
{
|
||||||
hash_agg_enter_spill_mode(aggstate);
|
hash_agg_enter_spill_mode(aggstate);
|
||||||
@ -1898,7 +1898,7 @@ static void
|
|||||||
hash_agg_update_metrics(AggState *aggstate, bool from_tape, int npartitions)
|
hash_agg_update_metrics(AggState *aggstate, bool from_tape, int npartitions)
|
||||||
{
|
{
|
||||||
Size meta_mem;
|
Size meta_mem;
|
||||||
Size hash_mem;
|
Size hashkey_mem;
|
||||||
Size buffer_mem;
|
Size buffer_mem;
|
||||||
Size total_mem;
|
Size total_mem;
|
||||||
|
|
||||||
@ -1910,7 +1910,7 @@ hash_agg_update_metrics(AggState *aggstate, bool from_tape, int npartitions)
|
|||||||
meta_mem = MemoryContextMemAllocated(aggstate->hash_metacxt, true);
|
meta_mem = MemoryContextMemAllocated(aggstate->hash_metacxt, true);
|
||||||
|
|
||||||
/* memory for the group keys and transition states */
|
/* memory for the group keys and transition states */
|
||||||
hash_mem = MemoryContextMemAllocated(aggstate->hashcontext->ecxt_per_tuple_memory, true);
|
hashkey_mem = MemoryContextMemAllocated(aggstate->hashcontext->ecxt_per_tuple_memory, true);
|
||||||
|
|
||||||
/* memory for read/write tape buffers, if spilled */
|
/* memory for read/write tape buffers, if spilled */
|
||||||
buffer_mem = npartitions * HASHAGG_WRITE_BUFFER_SIZE;
|
buffer_mem = npartitions * HASHAGG_WRITE_BUFFER_SIZE;
|
||||||
@ -1918,7 +1918,7 @@ hash_agg_update_metrics(AggState *aggstate, bool from_tape, int npartitions)
|
|||||||
buffer_mem += HASHAGG_READ_BUFFER_SIZE;
|
buffer_mem += HASHAGG_READ_BUFFER_SIZE;
|
||||||
|
|
||||||
/* update peak mem */
|
/* update peak mem */
|
||||||
total_mem = meta_mem + hash_mem + buffer_mem;
|
total_mem = meta_mem + hashkey_mem + buffer_mem;
|
||||||
if (total_mem > aggstate->hash_mem_peak)
|
if (total_mem > aggstate->hash_mem_peak)
|
||||||
aggstate->hash_mem_peak = total_mem;
|
aggstate->hash_mem_peak = total_mem;
|
||||||
|
|
||||||
@ -1936,7 +1936,7 @@ hash_agg_update_metrics(AggState *aggstate, bool from_tape, int npartitions)
|
|||||||
{
|
{
|
||||||
aggstate->hashentrysize =
|
aggstate->hashentrysize =
|
||||||
sizeof(TupleHashEntryData) +
|
sizeof(TupleHashEntryData) +
|
||||||
(hash_mem / (double) aggstate->hash_ngroups_current);
|
(hashkey_mem / (double) aggstate->hash_ngroups_current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user