-
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
session: add session variable tidb_optimizer_selectivity_level
.
#6289
Conversation
tidb_optimization_level
.tidb_optimizer_selectivity_level
.
session/session.go
Outdated
@@ -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 + "')" |
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.
We do not need to make it a global variable.
sessionctx/variable/session.go
Outdated
@@ -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 |
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.
Rename it?
sessionctx/variable/session.go
Outdated
@@ -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. |
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 comment needs to be updated as well.
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
sessionctx/variable/varsutil.go
Outdated
@@ -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 { |
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 think the old name is more specific, maybe we should revert this name refactor ?
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.
it has another function called tidbOptInt64
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.
tidbOptInt64
doesn't check whether this values is positive, while tidbOptPositiveInt
does.
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.
maybe tidbOptPositiveInt32
is a good name ?
sessionctx/variable/tidb_vars.go
Outdated
@@ -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. |
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.
may be we can simplify the comment to "is used to control the selectivity estimation level"?
sessionctx/variable/session.go
Outdated
@@ -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. |
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.
ditto
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
/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 { |
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 change the function name?
Will take effect in future.
PTAL @coocood @zz-jason @lamxTyler