未验证 提交 40d955d6 编写于 作者: W Weinan WANG 提交者: GitHub

Rid resource group on hashagg spill evaluation (#8199)

Resource group believe memory access speed always faster than disk,
and it adds hashagg executor node spill mechanism into its memory management.
If the hash table size overwhelms `max_mem`, in resource group model, the hash
table does not spill and fan out data. Resource group wants to grant more memory
for the hash table. However, this strategy impact hash collision rate, so that
some performance regression in some OLAP query.

We rid resource group guc when hashagg evaluate if it needs to spill.
Co-authored-by: NAdam Li <ali@pivotal.io>
上级 79c83ea1
......@@ -314,24 +314,7 @@ makeHashAggEntryForInput(AggState *aggstate, TupleTableSlot *inputslot, uint32 h
if (GET_TOTAL_USED_SIZE(hashtable) + MAXALIGN(MAXALIGN(tup_len) + aggs_len) >=
hashtable->max_mem)
{
if (IsResGroupEnabled())
{
elog(HHA_MSG_LVL,
"HashAgg: no enough operator memory to store new tuple: "
"operator memory is %.0f bytes, "
"current used size is %.0f bytes, "
"need %lu bytes to store the new tuple; "
"the overuse is allowed in resource group mode",
hashtable->max_mem,
GET_TOTAL_USED_SIZE(hashtable),
MAXALIGN(MAXALIGN(tup_len) + aggs_len));
}
else
{
return NULL;
}
}
return NULL;
/*
* Form memtuple into group_buf.
......@@ -377,24 +360,7 @@ makeHashAggEntryForGroup(AggState *aggstate, void *tuple_and_aggs,
MemoryContext oldcxt;
if (GET_TOTAL_USED_SIZE(hashtable) + input_size >= hashtable->max_mem)
{
if (IsResGroupEnabled())
{
elog(HHA_MSG_LVL,
"HashAgg: no enough operator memory to store new group keys and aggregate values: "
"operator memory is %.0f bytes, "
"current used size is %.0f bytes, "
"need %d bytes to store the new data; "
"the overuse is allowed in resource group mode",
hashtable->max_mem,
GET_TOTAL_USED_SIZE(hashtable),
input_size);
}
else
{
return NULL;
}
}
return NULL;
copy_tuple_and_aggs = mpool_alloc(hashtable->group_buf, input_size);
memcpy(copy_tuple_and_aggs, tuple_and_aggs, input_size);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册