Skip to content
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

Merged
merged 2 commits into from
Dec 13, 2016
Merged

plan: eliminate tablescan's cost more precisely. #2243

merged 2 commits into from
Dec 13, 2016

Conversation

hanfei1991
Copy link
Member

We forget to consider cpu cost when the table scan has a condition.
@shenli @coocood @zimulala PTAL

@@ -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
Copy link
Member

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.

Copy link
Member

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 {
Copy link
Member

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?

Copy link
Member Author

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.

@shenli
Copy link
Member

shenli commented Dec 13, 2016

LGTM

@shenli
Copy link
Member

shenli commented Dec 13, 2016

@coocood PTAL

@coocood
Copy link
Member

coocood commented Dec 13, 2016

LGTM

@shenli shenli merged commit 14b6696 into master Dec 13, 2016
@shenli shenli deleted the hanfei/cbo branch December 13, 2016 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants