-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
planner: refactor the cost implementation for Table/IndexReader/Scan, IndexLookup, Proj and Sel #34091
planner: refactor the cost implementation for Table/IndexReader/Scan, IndexLookup, Proj and Sel #34091
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/d8ead412c0be1f2981230362e898dcad40e66518 |
return 0, err | ||
} | ||
p.planCost = childCost | ||
p.planCost += p.GetCost(p.StatsCount()) // projection cost |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't ban the GetCost
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Operator.GetCost
is used to calculate the current operator's cost, which can be re-used directly in the new cost interface as well.
planner/core/plan_cost.go
Outdated
// consider concurrency | ||
p.planCost /= float64(p.ctx.GetSessionVars().DistSQLScanConcurrency()) | ||
|
||
// lookup-cost(table-size seek cost) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we miss table-side seek cost here?
Lines 1076 to 1081 in 5ba2adb
switch ts.StoreType { | |
case kv.TiKV: | |
t.cst += float64(len(ts.Ranges)) * sessVars.GetSeekFactor(ts.Table) | |
case kv.TiFlash: | |
t.cst += float64(len(ts.Ranges)) * float64(len(ts.Columns)) * sessVars.GetSeekFactor(ts.Table) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Besides, GetPlanCost
and GetCost
look so similar. Maybe we should rename one of the two to distinguish.
/merge |
This pull request has been accepted and is ready to merge. Commit hash: d8ead41
|
TiDB MergeCI notify
|
… IndexLookup, Proj and Sel (pingcap#34091) ref pingcap#33945
What problem does this PR solve?
Issue Number: ref #33945
Problem Summary: planner: refactor the cost implementation for Table/IndexReader/Scan, IndexLookup, Proj and Sel
What is changed and how it works?
No logical change, just refactoring. Refactor the cost implementation for these operators: Table/IndexReader/Scan, IndexLookup, Proj and Sel.
Please see #33945 for more details.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.