-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: support reader operators cost detail #36963
Conversation
Signed-off-by: yisaer <[email protected]>
[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. |
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/644a561d9d9252d4cab9e09127e1c6d9312f47e3 |
// consider concurrency | ||
p.planCost /= float64(p.ctx.GetSessionVars().DistSQLScanConcurrency()) | ||
p.planCost /= float64(sqlScanConcurrency) | ||
case kv.TiFlash: |
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.
The kv.TiFlash
case is not handled.
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.
Optimize Tracer can't handle tiflash well for now, thus we don't cover tiflash currently.
logRowSize := math.Log2(rowSize) | ||
selfCost = getCardinality(p, costFlag) * logRowSize * scanFactor | ||
rowCount = getCardinality(p, costFlag) | ||
selfCost = rowCount * logRowSize * scanFactor | ||
|
||
// give TiFlash a start-up cost to let the optimizer prefers to use TiKV to process small table scans. | ||
if p.StoreType == kv.TiFlash { | ||
selfCost += 2000 * logRowSize * scanFactor |
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 need to record this?
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.
Better to record it as well. @Yisaer
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 4ec704f
|
Signed-off-by: yisaer [email protected]
What problem does this PR solve?
Issue Number: ref #36962
Problem Summary:
What is changed and how it works?
support reader operators cost detail including
BatchPointGet
/IndexReader
/IndexScan
/TableReader
/TableScan
Check List
Tests
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.