Skip to content

Commit 6c016ed

Browse files
committed
support
1 parent b5ff518 commit 6c016ed

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

executor/index_advise_test.go

+6-7
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ and b.txn_accno = a.new_accno;`
107107
{" └─Selection_11"},
108108
{" └─IndexRangeScan_10"},
109109
}
110-
tk.Session().GetSessionVars().EnableIndexJoinInnerSideMultiPattern = true
110+
tk.MustExec("set @@session.tidb_enable_inl_join_inner_multi_pattern='ON'")
111111
tk.MustQuery("explain "+sql).CheckAt([]int{0}, rows)
112112
rows = [][]interface{}{
113113
{"Update_8"},
@@ -118,10 +118,10 @@ and b.txn_accno = a.new_accno;`
118118
{" └─Selection_13"},
119119
{" └─TableFullScan_12"},
120120
}
121-
tk.Session().GetSessionVars().EnableIndexJoinInnerSideMultiPattern = false
121+
tk.MustExec("set @@session.tidb_enable_inl_join_inner_multi_pattern='OFF'")
122122
tk.MustQuery("explain "+sql).CheckAt([]int{0}, rows)
123123

124-
tk.Session().GetSessionVars().EnableIndexJoinInnerSideMultiPattern = true
124+
tk.MustExec("set @@session.tidb_enable_inl_join_inner_multi_pattern='ON'")
125125
tk.MustExec(sql)
126126
tk.MustQuery("select yn_frz from t2").Check(testkit.Rows("1"))
127127
}
@@ -177,7 +177,7 @@ txn_dt date default null
177177
{" └─Selection_15"},
178178
{" └─TableFullScan_14"},
179179
}
180-
tk.Session().GetSessionVars().EnableIndexJoinInnerSideMultiPattern = false
180+
tk.MustExec("set @@session.tidb_enable_inl_join_inner_multi_pattern='OFF'")
181181
tk.MustQuery("explain "+sql).CheckAt([]int{0}, rows)
182182
rows = [][]interface{}{
183183
{"IndexJoin_13"},
@@ -190,10 +190,9 @@ txn_dt date default null
190190
{" └─Selection_10(Probe)"},
191191
{" └─TableRowIDScan_9"},
192192
}
193-
tk.Session().GetSessionVars().EnableIndexJoinInnerSideMultiPattern = true
193+
tk.MustExec("set @@session.tidb_enable_inl_join_inner_multi_pattern='ON'")
194194
tk.MustQuery("explain "+sql).CheckAt([]int{0}, rows)
195-
tk.Session().GetSessionVars().EnableIndexJoinInnerSideMultiPattern = true
196195
tk.MustQuery(sql).Check(testkit.Rows("1 2022-12-01 123 1 2022-12-01 123 1 <nil>"))
197-
tk.Session().GetSessionVars().EnableIndexJoinInnerSideMultiPattern = false
196+
tk.MustExec("set @@session.tidb_enable_inl_join_inner_multi_pattern='OFF'")
198197
tk.MustQuery(sql).Check(testkit.Rows("1 2022-12-01 123 1 2022-12-01 123 1 <nil>"))
199198
}

planner/core/exhaust_physical_plans.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ func (p *LogicalJoin) extractIndexJoinInnerChildPattern(innerChild LogicalPlan)
759759
}
760760
}
761761
case *LogicalProjection:
762-
if !p.ctx.GetSessionVars().EnableIndexJoinInnerSideMultiPattern {
762+
if !p.ctx.GetSessionVars().EnableINLJoinInnerMultiPattern {
763763
return nil
764764
}
765765
// For now, we only allow proj with all Column expression can be the inner side of index join
@@ -775,7 +775,7 @@ func (p *LogicalJoin) extractIndexJoinInnerChildPattern(innerChild LogicalPlan)
775775
}
776776
wrapper.ds = ds
777777
case *LogicalSelection:
778-
if !p.ctx.GetSessionVars().EnableIndexJoinInnerSideMultiPattern {
778+
if !p.ctx.GetSessionVars().EnableINLJoinInnerMultiPattern {
779779
return nil
780780
}
781781
wrapper.sel = child
@@ -1092,7 +1092,7 @@ func (p *LogicalJoin) constructInnerTableScanTask(
10921092
}
10931093

10941094
func (p *LogicalJoin) constructInnerByWrapper(wrapper *indexJoinInnerChildWrapper, child PhysicalPlan) PhysicalPlan {
1095-
if !p.ctx.GetSessionVars().EnableIndexJoinInnerSideMultiPattern {
1095+
if !p.ctx.GetSessionVars().EnableINLJoinInnerMultiPattern {
10961096
if wrapper.us != nil {
10971097
return p.constructInnerUnionScan(wrapper.us, child)
10981098
}

sessionctx/variable/session.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1358,9 +1358,9 @@ type SessionVars struct {
13581358
// is enabled.
13591359
PessimisticTransactionAggressiveLocking bool
13601360

1361-
// EnableIndexJoinInnerSideMultiPattern indicates whether enable multi pattern for index join inner side
1361+
// EnableINLJoinInnerMultiPattern indicates whether enable multi pattern for index join inner side
13621362
// For now it is not public to user
1363-
EnableIndexJoinInnerSideMultiPattern bool
1363+
EnableINLJoinInnerMultiPattern bool
13641364
}
13651365

13661366
// planReplayerSessionFinishedTaskKeyLen is used to control the max size for the finished plan replayer task key in session

sessionctx/variable/sysvar.go

+9
Original file line numberDiff line numberDiff line change
@@ -2357,6 +2357,15 @@ var defaultSysVars = []*SysVar{
23572357
s.EnablePlanCacheForParamLimit = TiDBOptOn(val)
23582358
return nil
23592359
}},
2360+
{Scope: ScopeGlobal | ScopeSession, Name: TiDBEnableINLJoinInnerMultiPattern, Value: BoolToOnOff(false), Type: TypeBool,
2361+
SetSession: func(s *SessionVars, val string) error {
2362+
s.EnableINLJoinInnerMultiPattern = TiDBOptOn(val)
2363+
return nil
2364+
},
2365+
GetSession: func(s *SessionVars) (string, error) {
2366+
return BoolToOnOff(s.EnableINLJoinInnerMultiPattern), nil
2367+
},
2368+
},
23602369
}
23612370

23622371
// FeedbackProbability points to the FeedbackProbability in statistics package.

sessionctx/variable/tidb_vars.go

+3
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,9 @@ const (
806806

807807
// TiDBEnablePlanCacheForParamLimit controls whether prepare statement with parameterized limit can be cached
808808
TiDBEnablePlanCacheForParamLimit = "tidb_enable_plan_cache_for_param_limit"
809+
810+
// TiDBEnableINLJoinInnerMultiPattern indicates whether enable multi pattern for inner side of inl join
811+
TiDBEnableINLJoinInnerMultiPattern = "tidb_enable_inl_join_inner_multi_pattern"
809812
)
810813

811814
// TiDB vars that have only global scope

0 commit comments

Comments
 (0)