Skip to content

Commit

Permalink
support set value of tidb_opt_distinct_agg_push_down in config… (ping…
Browse files Browse the repository at this point in the history
  • Loading branch information
windtalker authored Apr 22, 2020
1 parent db7c135 commit c28a695
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ type Performance struct {
TCPKeepAlive bool `toml:"tcp-keep-alive" json:"tcp-keep-alive"`
CrossJoin bool `toml:"cross-join" json:"cross-join"`
RunAutoAnalyze bool `toml:"run-auto-analyze" json:"run-auto-analyze"`
DistinctAggPushDown bool `toml:"distinct-agg-push-down" json:"agg-push-down-join"`
}

// PlanCache is the PlanCache section of the config.
Expand Down Expand Up @@ -592,6 +593,7 @@ var defaultConf = Config{
ForcePriority: "NO_PRIORITY",
BindInfoLease: "3s",
TxnTotalSizeLimit: DefTxnTotalSizeLimit,
DistinctAggPushDown: false,
},
ProxyProtocol: ProxyProtocol{
Networks: "",
Expand Down
3 changes: 3 additions & 0 deletions config/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ force-priority = "NO_PRIORITY"
# Bind info lease duration, which influences the duration of loading bind info and handling invalid bind.
bind-info-lease = "3s"

# Whether support pushing down aggregation with distinct to cop task
distinct-agg-push-down = false

# The limitation of the size in byte for the entries in one transaction.
# If using TiKV as the storage, the entry represents a key/value pair.
# NOTE: If binlog is enabled, this value should be less than 104857600(10M) because this is the maximum size that can be handled by Pumper.
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ var defaultSysVars = []*SysVar{
/* TiDB specific variables */
{ScopeSession, TiDBSnapshot, ""},
{ScopeSession, TiDBOptAggPushDown, BoolToIntStr(DefOptAggPushDown)},
{ScopeSession, TiDBOptDistinctAggPushDown, BoolToIntStr(DefOptDistinctAggPushDown)},
{ScopeSession, TiDBOptDistinctAggPushDown, BoolToIntStr(config.GetGlobalConfig().Performance.DistinctAggPushDown)},
{ScopeSession, TiDBOptWriteRowID, BoolToIntStr(DefOptWriteRowID)},
{ScopeGlobal | ScopeSession, TiDBBuildStatsConcurrency, strconv.Itoa(DefBuildStatsConcurrency)},
{ScopeGlobal, TiDBAutoAnalyzeRatio, strconv.FormatFloat(DefAutoAnalyzeRatio, 'f', -1, 64)},
Expand Down
1 change: 0 additions & 1 deletion sessionctx/variable/tidb_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ const (
DefChecksumTableConcurrency = 4
DefSkipUTF8Check = false
DefOptAggPushDown = false
DefOptDistinctAggPushDown = false
DefOptWriteRowID = false
DefOptCorrelationThreshold = 0.9
DefOptCorrelationExpFactor = 1
Expand Down
1 change: 1 addition & 0 deletions tidb-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ func setGlobalVars() {
priority := mysql.Str2Priority(cfg.Performance.ForcePriority)
variable.ForcePriority = int32(priority)
variable.SysVars[variable.TiDBForcePriority].Value = mysql.Priority2Str[priority]
variable.SysVars[variable.TiDBOptDistinctAggPushDown].Value = variable.BoolToIntStr(cfg.Performance.DistinctAggPushDown)

variable.SysVars[variable.TIDBMemQuotaQuery].Value = strconv.FormatInt(cfg.MemQuotaQuery, 10)
variable.SysVars["lower_case_table_names"].Value = strconv.Itoa(cfg.LowerCaseTableNames)
Expand Down

0 comments on commit c28a695

Please sign in to comment.