Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdece64a

Browse files
committed
Fix incorrect comment for get_agg_clause_costs
Adjust the header comment in get_agg_clause_costs so that it matches whatthe function currently does. No recursive searching has been done eversince0a2bc5d. It also does not determine the aggtranstype like thecomment claimed. That's all done in preprocess_aggref().preprocess_aggref also now determines the numOrderedAggs, so remove themention that get_agg_clause_costs also calculates "counts".Normally, since this is just an adjustment of a comment it might not beworth back-patching, but since this code is new to PG14 and that versionis still in beta, then it seems worth having the comments match.Discussion:https://postgr.es/m/CAApHDvrrGrTJFPELrjx0CnDtz9B7Jy2XYW3Z2BKifAWLSaJYwQ@mail.gmail.comBackpatch-though: 14
1 parentb0d2867 commitdece64a

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

‎src/backend/optimizer/prep/prepagg.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -515,28 +515,24 @@ GetAggInitVal(Datum textInitVal, Oid transtype)
515515

516516
/*
517517
* get_agg_clause_costs
518-
*Recursively findtheAggref nodes in an expression tree, and
519-
*accumulate cost information about them.
518+
*ProcessthePlannerInfo's 'aggtransinfos' and 'agginfos' lists
519+
*accumulating the cost information about them.
520520
*
521521
* 'aggsplit' tells us the expected partial-aggregation mode, which affects
522522
* the cost estimates.
523523
*
524-
* NOTE that thecounts/costs are ADDED to those already in *costs ... so
525-
*the calleris responsible for zeroing the struct initially.
524+
* NOTE that the costs are ADDED to those already in *costs ... so the caller
525+
* is responsible for zeroing the struct initially.
526526
*
527-
* We count the nodes, estimate their execution costs, and estimate the total
528-
* space needed for their transition state values if all are evaluated in
529-
* parallel (as would be done in a HashAgg plan). Also, we check whether
530-
* partial aggregation is feasible. See AggClauseCosts for the exact set
531-
* of statistics collected.
527+
* For each AggTransInfo, we add the cost of an aggregate transition using
528+
* either the transfn or combinefn depending on the 'aggsplit' value. We also
529+
* account for the costs of any aggfilters and any serializations and
530+
* deserializations of the transition state and also estimate the total space
531+
* needed for the transition states as if each aggregate's state was stored in
532+
* memory concurrently (as would be done in a HashAgg plan).
532533
*
533-
* In addition, we mark Aggref nodes with the correct aggtranstype, so
534-
* that that doesn't need to be done repeatedly. (That makes this function's
535-
* name a bit of a misnomer.)
536-
*
537-
* This does not descend into subqueries, and so should be used only after
538-
* reduction of sublinks to subplans, or in contexts where it's known there
539-
* are no subqueries. There mustn't be outer-aggregate references either.
534+
* For each AggInfo in the 'agginfos' list we add the cost of running the
535+
* final function and the direct args, if any.
540536
*/
541537
void
542538
get_agg_clause_costs(PlannerInfo*root,AggSplitaggsplit,AggClauseCosts*costs)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp