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

session: add session variable tidb_optimizer_selectivity_level. #6289

Merged
merged 10 commits into from
Apr 16, 2018

Conversation

winoros
Copy link
Member

@winoros winoros commented Apr 16, 2018

Will take effect in future.
PTAL @coocood @zz-jason @lamxTyler

@winoros winoros changed the title session: add session variable tidb_optimization_level. session: add session variable tidb_optimizer_selectivity_level. Apr 16, 2018
@@ -1270,7 +1270,8 @@ const loadCommonGlobalVarsSQL = "select HIGH_PRIORITY * from mysql.global_variab
variable.TiDBIndexLookupJoinConcurrency + quoteCommaQuote +
variable.TiDBIndexSerialScanConcurrency + quoteCommaQuote +
variable.TiDBHashJoinConcurrency + quoteCommaQuote +
variable.TiDBDistSQLScanConcurrency + "')"
variable.TiDBDistSQLScanConcurrency + quoteCommaQuote +
variable.TiDBOptimizerSelectivityLevel + "')"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need to make it a global variable.

@@ -319,6 +319,8 @@ type SessionVars struct {
MemQuotaIndexLookupJoin int64
// MemQuotaNestedLoopApply defines the memory quota for a nested loop apply executor.
MemQuotaNestedLoopApply int64
// OptimizationLevel defines the level of tidb's planner.
OptimizationLevel int64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename it?

@@ -319,6 +319,8 @@ type SessionVars struct {
MemQuotaIndexLookupJoin int64
// MemQuotaNestedLoopApply defines the memory quota for a nested loop apply executor.
MemQuotaNestedLoopApply int64
// OptimizerSelectivityLevel defines the level of tidb's planner.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment needs to be updated as well.

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -128,7 +128,7 @@ func TiDBOptOn(opt string) bool {
return strings.EqualFold(opt, "ON") || opt == "1"
}

func tidbOptPositiveInt(opt string, defaultVal int) int {
func tidbOptInt32(opt string, defaultVal int) int {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the old name is more specific, maybe we should revert this name refactor ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it has another function called tidbOptInt64

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tidbOptInt64 doesn't check whether this values is positive, while tidbOptPositiveInt does.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe tidbOptPositiveInt32 is a good name ?

@@ -98,6 +98,9 @@ const (

// tidb_enable_streaming enables TiDB to use streaming API for coprocessor requests.
TiDBEnableStreaming = "tidb_enable_streaming"

// tidb_optimizer_selectivity_level is used for control the content of each operator's statistic information.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be we can simplify the comment to "is used to control the selectivity estimation level"?

@@ -319,6 +319,9 @@ type SessionVars struct {
MemQuotaIndexLookupJoin int64
// MemQuotaNestedLoopApply defines the memory quota for a nested loop apply executor.
MemQuotaNestedLoopApply int64
// OptimizerSelectivityLevel defines the what content operator will hold in its statistic information. The higher it
// is, the more complex content operator will hold.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zz-jason
Copy link
Member

/run-all-tests

@@ -128,7 +128,7 @@ func TiDBOptOn(opt string) bool {
return strings.EqualFold(opt, "ON") || opt == "1"
}

func tidbOptPositiveInt(opt string, defaultVal int) int {
func tidbOptPositiveInt32(opt string, defaultVal int) int {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the function name?

@zhexuany zhexuany merged commit 8777db2 into pingcap:master Apr 16, 2018
@winoros winoros deleted the planner-level branch April 23, 2018 09:37
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.

6 participants