Improve the performance of sum(int)
in TiFlash
#9764
Labels
type/enhancement
The issue or PR belongs to an enhancement.
sum(int)
in TiFlash
#9764
Enhancement
Currently, in TiFlash the result type of
sum(int)
isbigint
, and the result type ofsum(decimal)
isdecimal
, in TiDB/MySQL,sum(int)
will returndecimal
. In order to make TiFlash compatible with TiDB/MySQL, the planner in TiDB add an implict cast ofsum(int)
when pushdown to TiFlash likesum(cast(int as decimal))
.(Note we can not add cast after sum likecast(sum(int) as decimal)
becausesum(int)
may overflow.)This brings an extra cost when calculating
sum(int)
in TiFlash, which may hurt the performance a little bit. Ideally, we should change the behavior ofsum(int)
in TiFLash so it can returndecimal
directly.The text was updated successfully, but these errors were encountered: