Re: Memory-Bounded Hash Aggregation
От | Heikki Linnakangas |
---|---|
Тема | Re: Memory-Bounded Hash Aggregation |
Дата | |
Msg-id | 775d754c-9a61-5363-6998-f87d15f1b592@iki.fi обсуждение исходный текст |
Ответ на | Re: Memory-Bounded Hash Aggregation (Jeff Davis <pgsql@j-davis.com>) |
Ответы |
Re: Memory-Bounded Hash Aggregation
Re: Memory-Bounded Hash Aggregation |
Список | pgsql-hackers |
On 28/12/2019 01:35, Jeff Davis wrote: > I've attached a new patch that adds some basic costing for disk during > hashagg. This patch (hashagg-20191227.patch) doesn't compile: nodeAgg.c:3379:7: error: ‘hashagg_mem_overflow’ undeclared (first use in this function) if (hashagg_mem_overflow) ^~~~~~~~~~~~~~~~~~~~ Looks like the new GUCs got lost somewhere between hashagg-20191220.patch and hashagg-20191227.patch. > /* > * find_aggregated_cols > * Construct a bitmapset of the column numbers of aggregated Vars > * appearing in our targetlist and qual (HAVING clause) > */ > static Bitmapset * > find_aggregated_cols(AggState *aggstate) > { > Agg *node = (Agg *) aggstate->ss.ps.plan; > Bitmapset *colnos = NULL; > ListCell *temp; > > /* > * We only want the columns used by aggregations in the targetlist or qual > */ > if (node->plan.targetlist != NULL) > { > foreach(temp, (List *) node->plan.targetlist) > { > if (IsA(lfirst(temp), TargetEntry)) > { > Node *node = (Node *)((TargetEntry *)lfirst(temp))->expr; > if (IsA(node, Aggref) || IsA(node, GroupingFunc)) > find_aggregated_cols_walker(node, &colnos); > } > } > } This makes the assumption that all Aggrefs or GroupingFuncs are at the top of the TargetEntry. That's not true, e.g.: select 0+sum(a) from foo group by b; I think find_aggregated_cols() and find_unaggregated_cols() should be merged into one function that scans the targetlist once, and returns two Bitmapsets. They're always used together, anyway. - Heikki
В списке pgsql-hackers по дате отправления: