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

The formula of calculating net cost for TiFlash plans is not aligned with TiKV plans' #30103

Closed
qw4990 opened this issue Nov 24, 2021 · 3 comments · Fixed by #32942
Closed

The formula of calculating net cost for TiFlash plans is not aligned with TiKV plans' #30103

qw4990 opened this issue Nov 24, 2021 · 3 comments · Fixed by #32942
Assignees
Labels
epic/cost-model the optimizer cost model sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.

Comments

@qw4990
Copy link
Contributor

qw4990 commented Nov 24, 2021

Enhancement

In copTask.convertToRootTaskImpl, we can see the formula of calculating net cost for TiKV plans is est-row * row-size * net-factor, while in mppTask.convertToRootTaskImpl the formula for TiFlash plans is est-row * net-factor where the row-size is lost.
That would let the cost of TiFlash plans be always relatively lower than TiKV plans', which can cause some wrong plans.

@qw4990 qw4990 added type/enhancement The issue or PR belongs to an enhancement. sig/planner SIG: Planner labels Nov 24, 2021
@qw4990 qw4990 self-assigned this Nov 24, 2021
@qw4990 qw4990 added the epic/cost-model the optimizer cost model label Nov 24, 2021
@zhangjinpeng87
Copy link
Contributor

It should be a bug? @qw4990

@zhangjinpeng87 zhangjinpeng87 added type/bug The issue is confirmed as a bug. severity/major and removed type/enhancement The issue or PR belongs to an enhancement. labels Dec 1, 2021
@qw4990
Copy link
Contributor Author

qw4990 commented Dec 1, 2021

It should be a bug? @qw4990

Yep, we can regard this issue as a bug also, but it may not be appropriate.
To fix it, we have to design some experiments and test cases to evaluate the new formula to ensure there is no regression, which is what we are doing in Sprint6.
It seems that we cannot fix it like a bug quickly, so I just labeled it with enhancement and planned to solve it in Sprint6 by the project Cardinality&Cost Enhancement.

@yudongusa
Copy link

yudongusa commented Dec 2, 2021

This is part of cost model enhancement planned in Sprint 6 in which this and other related costing enhancement and issues will be examined and improved. For this particular issue, a simple addition of row_size may not work as TiFlash only scans and transmits certain columns, so rather a fine tuning of the TiFlash cost formula would be needed based on some experiments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic/cost-model the optimizer cost model sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants