-
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: eliminate tablescan's cost more precisely. #2243
Conversation
ed33e82
to
8158ae6
Compare
@@ -65,26 +65,30 @@ type physicalDistSQLPlan interface { | |||
addAggregation(ctx context.Context, agg *PhysicalAggregation) expression.Schema | |||
addTopN(ctx context.Context, prop *requiredProperty) bool | |||
addLimit(limit *Limit) | |||
calculateCost(count uint64) float64 | |||
calculateCost(count uint64, scanCount uint64) 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.
Add comment for the two parameters.
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.
Should we rename count to resultCount?
} | ||
|
||
func (p *PhysicalIndexScan) calculateCost(count uint64) float64 { | ||
cnt := float64(count) | ||
func (p *PhysicalIndexScan) calculateCost(resultCount uint64, scanCount uint64) 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 scanCount is not used 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.
I have added a todo list here. index elimination is more complex, which need to consider index filter and table filter in the same time.
LGTM |
@coocood PTAL |
LGTM |
We forget to consider cpu cost when the table scan has a condition.
@shenli @coocood @zimulala PTAL