Skip to content

Commit

Permalink
v8: 1. remove aggcostFactor. 2. DEFAULT_AGGREGATE_RATIO=1/3
Browse files Browse the repository at this point in the history
  • Loading branch information
englefly committed Aug 27, 2024
1 parent ffa0b85 commit 7327a4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,16 +338,15 @@ public Cost visitPhysicalHashAggregate(
PhysicalHashAggregate<? extends Plan> aggregate, PlanContext context) {
Statistics inputStatistics = context.getChildStatistics(0);
double exprCost = expressionTreeCost(aggregate.getExpressions());
double aggCostBaseFactor = 3;
if (aggregate.getAggPhase().isLocal()) {
return CostV1.of(context.getSessionVariable(),
exprCost / 100 + aggCostBaseFactor * inputStatistics.getRowCount() / beNumber,
aggCostBaseFactor * inputStatistics.getRowCount() / beNumber, 0);
exprCost / 100 + inputStatistics.getRowCount() / beNumber,
inputStatistics.getRowCount() / beNumber, 0);
} else {
// global
return CostV1.of(context.getSessionVariable(), exprCost / 100
+ aggCostBaseFactor * inputStatistics.getRowCount(),
aggCostBaseFactor * inputStatistics.getRowCount(), 0);
+ inputStatistics.getRowCount(),
inputStatistics.getRowCount(), 0);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
* Used to calculate the stats for each plan
*/
public class StatsCalculator extends DefaultPlanVisitor<Statistics, Void> {
public static double DEFAULT_AGGREGATE_RATIO = 0.45;
public static double DEFAULT_AGGREGATE_RATIO = 1 / 3.0;
public static double AGGREGATE_COLUMN_CORRELATION_COEFFICIENT = 0.75;
public static double DEFAULT_COLUMN_NDV_RATIO = 0.5;

Expand Down

0 comments on commit 7327a4b

Please sign in to comment.