-
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
plan: add task profile. #2902
plan: add task profile. #2902
Conversation
@shenli @coocood @zimulala @tiancaiamao @XuHuaiyu @ilovesoup @lamxTyler @winoros |
17b6e1a
to
140f6a0
Compare
This need a complete design document. |
@coocood I am agree with you. |
6f85e56
to
0945862
Compare
s/kvTask/copTask |
plan/task_profile.go
Outdated
import "github.com/pingcap/tidb/expression" | ||
|
||
// taskProfile is a new version of `PhysicalPlanInfo`. It stores cost information for a task. | ||
// A task may be KVTask, SingletonTask, MPPTask or a ParallelTask. |
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.
Update the comment.
plan/task_profile.go
Outdated
|
||
// taskProfile is a new version of `PhysicalPlanInfo`. It stores cost information for a task. | ||
// A task may be KVTask, SingletonTask, MPPTask or a ParallelTask. | ||
type taskProfile interface { |
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.
Need a toPB interface?
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.
Nope, toPB only required by kvTask.
plan/task_profile.go
Outdated
} | ||
} | ||
|
||
// rootTaskProfile is a profile running on tidb with single goroutine. |
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.
This description is better?
"rootTaskProfile is the final sink node of a plan graph. It should be a single goroutine on tidb."
plan/task_profile.go
Outdated
type copTaskProfile struct { | ||
indexPlan PhysicalPlan | ||
tablePlan PhysicalPlan | ||
cst float64 |
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.
Why not use cost? cst is rarely used.
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.
cost is used in function name
plan/task_profile.go
Outdated
func (t *copTaskProfile) finishTask() { | ||
t.cst += float64(t.cnt) * netWorkFactor | ||
if t.tablePlan != nil && t.indexPlan != nil { | ||
t.cst += float64(t.cnt) * netWorkFactor |
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.
t.cst *= 2?
plan/task_profile.go
Outdated
tablePlan PhysicalPlan | ||
cst float64 | ||
cnt uint64 | ||
addPlan2Index bool |
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.
Add comment for this.
plan/task_profile.go
Outdated
return profile | ||
} | ||
|
||
func (sel *Selection) splitSelectionByIndexColumns(schema *expression.Schema) (indexSel *Selection, tableSel *Selection) { |
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.
Add comment for this function.
@shenli PTAL |
LGTM |
plan/task_profile.go
Outdated
// taskProfile is a new version of `PhysicalPlanInfo`. It stores cost information for a task. | ||
// A task may be CopTask, RootTask, MPPTask or a ParallelTask. | ||
type taskProfile interface { | ||
attachPlan(p PhysicalPlan) taskProfile |
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.
Use a function instead of interface method is more intuitive.
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
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
We are planning to split the physical plan to computation tasks. This pr only define the structure for kvTask and singleton Task.