Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the performance of sum(int) in TiFlash #9764

Open
windtalker opened this issue Jan 6, 2025 · 0 comments
Open

Improve the performance of sum(int) in TiFlash #9764

windtalker opened this issue Jan 6, 2025 · 0 comments
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@windtalker
Copy link
Contributor

windtalker commented Jan 6, 2025

Enhancement

Currently, in TiFlash the result type of sum(int) is bigint, and the result type of sum(decimal) is decimal, in TiDB/MySQL, sum(int) will return decimal. In order to make TiFlash compatible with TiDB/MySQL, the planner in TiDB add an implict cast of sum(int) when pushdown to TiFlash like
sum(cast(int as decimal)).(Note we can not add cast after sum like cast(sum(int) as decimal) because sum(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 of sum(int) in TiFLash so it can return decimal directly.

@windtalker windtalker added the type/enhancement The issue or PR belongs to an enhancement. label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

1 participant