diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java index 5c1451e0139674e..498151185fcd389 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/cost/CostModelV1.java @@ -329,14 +329,16 @@ public Cost visitPhysicalHashAggregate( PhysicalHashAggregate 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 + inputStatistics.getRowCount() / beNumber, - inputStatistics.getRowCount() / beNumber, 0); + exprCost / 100 + aggCostBaseFactor * inputStatistics.getRowCount() / beNumber, + aggCostBaseFactor * inputStatistics.getRowCount() / beNumber, 0); } else { // global - return CostV1.of(context.getSessionVariable(), exprCost / 100 + inputStatistics.getRowCount(), - inputStatistics.getRowCount(), 0); + return CostV1.of(context.getSessionVariable(), exprCost / 100 + + aggCostBaseFactor * inputStatistics.getRowCount(), + aggCostBaseFactor * inputStatistics.getRowCount(), 0); } }