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. DetailsReviewer 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.
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.
Do we miss table-side seek cost here?
Lines 1076 to 1081 in 5ba2adb
xuyifangreeneyes
left a comment
There was a problem hiding this comment.
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. DetailsCommit 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.