From e5473c73fa9bbc272b07695a62895f96eb4c2b44 Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Wed, 11 Aug 2021 16:03:47 +0800 Subject: [PATCH 01/13] refine IsFullRange check for unsigned int handle table scan --- planner/core/explain.go | 10 ++++++++-- planner/core/find_best_task.go | 8 +++++++- planner/core/stats.go | 10 ++++++++-- util/ranger/types.go | 14 +++++++++++--- util/ranger/types_test.go | 21 ++++++++++++++++++--- 5 files changed, 52 insertions(+), 11 deletions(-) diff --git a/planner/core/explain.go b/planner/core/explain.go index 9ed849f19b796..91d3724f43c17 100644 --- a/planner/core/explain.go +++ b/planner/core/explain.go @@ -184,7 +184,7 @@ func (p *PhysicalIndexScan) isFullScan() bool { return false } for _, ran := range p.Ranges { - if !ran.IsFullRange() { + if !ran.IsFullRange(false) { return false } } @@ -322,7 +322,13 @@ func (p *PhysicalTableScan) isFullScan() bool { return false } for _, ran := range p.Ranges { - if !ran.IsFullRange() { + var unsignedIntHandle bool + if p.Table.PKIsHandle { + if pkColInfo := p.Table.GetPkColInfo(); pkColInfo != nil { + unsignedIntHandle = mysql.HasUnsignedFlag(pkColInfo.Flag) + } + } + if !ran.IsFullRange(unsignedIntHandle) { return false } } diff --git a/planner/core/find_best_task.go b/planner/core/find_best_task.go index 32e9e13de01a9..97c3617d31be4 100644 --- a/planner/core/find_best_task.go +++ b/planner/core/find_best_task.go @@ -626,8 +626,14 @@ func (ds *DataSource) skylinePruning(prop *property.PhysicalProperty) []*candida if ds.ctx.GetSessionVars().GetAllowPreferRangeScan() && len(candidates) > 1 { // remove the table/index full scan path for i, c := range candidates { + var unsignedIntHandle bool + if c.path.IsIntHandlePath && ds.tableInfo.PKIsHandle { + if pkColInfo := ds.tableInfo.GetPkColInfo(); pkColInfo != nil { + unsignedIntHandle = mysql.HasUnsignedFlag(pkColInfo.Flag) + } + } for _, ran := range c.path.Ranges { - if ran.IsFullRange() { + if ran.IsFullRange(unsignedIntHandle) { candidates = append(candidates[:i], candidates[i+1:]...) return candidates } diff --git a/planner/core/stats.go b/planner/core/stats.go index 3a21a6f14d904..17f03b53b040d 100644 --- a/planner/core/stats.go +++ b/planner/core/stats.go @@ -622,8 +622,14 @@ func (ds *DataSource) accessPathsForConds(conditions []expression.Expression, us logutil.BgLogger().Debug("can not derive statistics of a path", zap.Error(err)) continue } + var unsignedIntHandle bool + if path.IsIntHandlePath && ds.tableInfo.PKIsHandle { + if pkColInfo := ds.tableInfo.GetPkColInfo(); pkColInfo != nil { + unsignedIntHandle = mysql.HasUnsignedFlag(pkColInfo.Flag) + } + } // If the path contains a full range, ignore it. - if ranger.HasFullRange(path.Ranges) { + if ranger.HasFullRange(path.Ranges, unsignedIntHandle) { continue } // If we have point or empty range, just remove other possible paths. @@ -649,7 +655,7 @@ func (ds *DataSource) accessPathsForConds(conditions []expression.Expression, us } ds.deriveIndexPathStats(path, conditions, true) // If the path contains a full range, ignore it. - if ranger.HasFullRange(path.Ranges) { + if ranger.HasFullRange(path.Ranges, false) { continue } // If we have empty range, or point range on unique index, just remove other possible paths. diff --git a/util/ranger/types.go b/util/ranger/types.go index 26548ac1815bb..6fea3b8612534 100644 --- a/util/ranger/types.go +++ b/util/ranger/types.go @@ -106,7 +106,15 @@ func (ran *Range) IsPointNullable(sc *stmtctx.StatementContext) bool { } // IsFullRange check if the range is full scan range -func (ran *Range) IsFullRange() bool { +func (ran *Range) IsFullRange(unsignedIntHandle bool) bool { + if unsignedIntHandle { + if len(ran.LowVal) != 1 || len(ran.HighVal) != 1 { + return false + } + lowValRawString := formatDatum(ran.LowVal[0], true) + highValRawString := formatDatum(ran.HighVal[0], false) + return lowValRawString == "0" && highValRawString == "+inf" + } if len(ran.LowVal) != len(ran.HighVal) { return false } @@ -123,9 +131,9 @@ func (ran *Range) IsFullRange() bool { } // HasFullRange checks if any range in the slice is a full range. -func HasFullRange(ranges []*Range) bool { +func HasFullRange(ranges []*Range, unsignedIntHandle bool) bool { for _, ran := range ranges { - if ran.IsFullRange() { + if ran.IsFullRange(unsignedIntHandle) { return true } } diff --git a/util/ranger/types_test.go b/util/ranger/types_test.go index d348479f8fef6..47ae10513aaac 100644 --- a/util/ranger/types_test.go +++ b/util/ranger/types_test.go @@ -136,14 +136,16 @@ func (s *testRangeSuite) TestIsFullRange(c *C) { nullDatum := types.MinNotNullDatum() nullDatum.SetNull() isFullRangeTests := []struct { - ran ranger.Range - isFullRange bool + ran ranger.Range + unsignedIntHandle bool + isFullRange bool }{ { ran: ranger.Range{ LowVal: []types.Datum{types.NewIntDatum(math.MinInt64)}, HighVal: []types.Datum{types.NewIntDatum(math.MaxInt64)}, }, + unsignedIntHandle: false, isFullRange: true, }, { @@ -151,6 +153,7 @@ func (s *testRangeSuite) TestIsFullRange(c *C) { LowVal: []types.Datum{types.NewIntDatum(math.MaxInt64)}, HighVal: []types.Datum{types.NewIntDatum(math.MinInt64)}, }, + unsignedIntHandle: false, isFullRange: false, }, { @@ -158,6 +161,7 @@ func (s *testRangeSuite) TestIsFullRange(c *C) { LowVal: []types.Datum{types.NewIntDatum(1)}, HighVal: []types.Datum{types.NewUintDatum(math.MaxUint64)}, }, + unsignedIntHandle: false, isFullRange: false, }, { @@ -165,6 +169,7 @@ func (s *testRangeSuite) TestIsFullRange(c *C) { LowVal: []types.Datum{*nullDatum.Clone()}, HighVal: []types.Datum{types.NewUintDatum(math.MaxUint64)}, }, + unsignedIntHandle: false, isFullRange: true, }, { @@ -172,6 +177,7 @@ func (s *testRangeSuite) TestIsFullRange(c *C) { LowVal: []types.Datum{*nullDatum.Clone()}, HighVal: []types.Datum{*nullDatum.Clone()}, }, + unsignedIntHandle: false, isFullRange: false, }, { @@ -179,10 +185,19 @@ func (s *testRangeSuite) TestIsFullRange(c *C) { LowVal: []types.Datum{types.MinNotNullDatum()}, HighVal: []types.Datum{types.MaxValueDatum()}, }, + unsignedIntHandle: false, + isFullRange: true, + }, + { + ran: ranger.Range{ + LowVal: []types.Datum{types.NewUintDatum(0)}, + HighVal: []types.Datum{types.NewUintDatum(math.MaxUint64)}, + }, + unsignedIntHandle: true, isFullRange: true, }, } for _, t := range isFullRangeTests { - c.Assert(t.ran.IsFullRange(), Equals, t.isFullRange) + c.Assert(t.ran.IsFullRange(t.unsignedIntHandle), Equals, t.isFullRange) } } From 0d19b51daa7aa0302dacbafa31d20d51353d6558 Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Wed, 11 Aug 2021 16:31:48 +0800 Subject: [PATCH 02/13] add testcases --- planner/core/integration_test.go | 24 +++++++++++++ .../core/testdata/integration_suite_in.json | 9 +++++ .../core/testdata/integration_suite_out.json | 35 +++++++++++++++++++ 3 files changed, 68 insertions(+) diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index b5aaa59330d60..9d4815312c4d5 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -4201,3 +4201,27 @@ func (s *testIntegrationSuite) TestOutputSkylinePruningInfo(c *C) { tk.MustQuery("show warnings").Check(testkit.Rows(output[i].Warnings...)) } } + +func (s *testIntegrationSuite) TestPreferRangeScanForUnsignedIntHandle(c *C) { + tk := testkit.NewTestKit(c, s.store) + tk.MustExec("use test") + tk.MustExec("drop table if exists t") + tk.MustExec("create table t(a int unsigned primary key, b int, c int, index idx_b(b))") + + var input []string + var output []struct { + SQL string + Plan []string + Warnings []string + } + s.testData.GetTestCases(c, &input, &output) + for i, tt := range input { + s.testData.OnRecord(func() { + output[i].SQL = tt + output[i].Plan = s.testData.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) + output[i].Warnings = s.testData.ConvertRowsToStrings(tk.MustQuery("show warnings").Rows()) + }) + tk.MustQuery(tt).Check(testkit.Rows(output[i].Plan...)) + tk.MustQuery("show warnings").Check(testkit.Rows(output[i].Warnings...)) + } +} diff --git a/planner/core/testdata/integration_suite_in.json b/planner/core/testdata/integration_suite_in.json index 0723b76e44f53..21142150bf17e 100644 --- a/planner/core/testdata/integration_suite_in.json +++ b/planner/core/testdata/integration_suite_in.json @@ -341,5 +341,14 @@ "select * from t where g = 5 order by f", "select * from t where d = 3 order by c, e" ] + }, + { + "name": "TestPreferRangeScanForUnsignedIntHandle", + "cases": [ + "set tidb_opt_prefer_range_scan = 0", + "explain format = 'verbose' select * from t where b > 5", + "set tidb_opt_prefer_range_scan = 1", + "explain format = 'verbose' select * from t where b > 5" + ] } ] diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index fb581eca57364..a17c2344d6d1f 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -1805,5 +1805,40 @@ ] } ] + }, + { + "Name": "TestPreferRangeScanForUnsignedIntHandle", + "Cases": [ + { + "SQL": "set tidb_opt_prefer_range_scan = 0", + "Plan": null, + "Warnings": null + }, + { + "SQL": "explain format = 'verbose' select * from t where b > 5", + "Plan": [ + "TableReader_7 3333.33 45418.00 root data:Selection_6", + "└─Selection_6 3333.33 600020.00 cop[tikv] gt(test.t.b, 5)", + " └─TableFullScan_5 10000.00 570020.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warnings": null + }, + { + "SQL": "set tidb_opt_prefer_range_scan = 1", + "Plan": null, + "Warnings": null + }, + { + "SQL": "explain format = 'verbose' select * from t where b > 5", + "Plan": [ + "IndexLookUp_7 3333.33 70785.94 root ", + "├─IndexRangeScan_5(Build) 3333.33 190020.00 cop[tikv] table:t, index:idx_b(b) range:(5,+inf], keep order:false, stats:pseudo", + "└─TableRowIDScan_6(Probe) 3333.33 190020.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warnings": [ + "Note 1105 [idx_b] remain after pruning paths for t given Prop{SortItems: [], TaskTp: rootTask}" + ] + } + ] } ] From d054f38bb1076ed0ecaf0f2610e610d1a1b8eeaa Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Wed, 11 Aug 2021 19:17:58 +0800 Subject: [PATCH 03/13] refine prefer-range-scan; add global switch; add testcase --- executor/set_test.go | 10 ++++ planner/core/find_best_task.go | 21 +++++--- planner/core/integration_test.go | 12 +++++ .../integration_partition_suite_out.json | 4 +- .../core/testdata/integration_suite_in.json | 6 ++- .../core/testdata/integration_suite_out.json | 48 ++++++++++++++++++- sessionctx/variable/sysvar.go | 2 +- 7 files changed, 91 insertions(+), 12 deletions(-) diff --git a/executor/set_test.go b/executor/set_test.go index 667f4ecf3880a..5c91a632b5e97 100644 --- a/executor/set_test.go +++ b/executor/set_test.go @@ -539,6 +539,16 @@ func (s *testSerialSuite1) TestSetVar(c *C) { tk.MustExec(`set tidb_opt_limit_push_down_threshold = 20`) tk.MustQuery(`select @@global.tidb_opt_limit_push_down_threshold`).Check(testkit.Rows("100")) tk.MustQuery(`select @@tidb_opt_limit_push_down_threshold`).Check(testkit.Rows("20")) + + tk.MustQuery("select @@tidb_opt_prefer_range_scan").Check(testkit.Rows("0")) + tk.MustExec("set global tidb_opt_prefer_range_scan = 1") + tk.MustQuery("select @@global.tidb_opt_prefer_range_scan").Check(testkit.Rows("1")) + tk.MustExec("set global tidb_opt_prefer_range_scan = 0") + tk.MustQuery("select @@global.tidb_opt_prefer_range_scan").Check(testkit.Rows("0")) + tk.MustExec("set session tidb_opt_prefer_range_scan = 1") + tk.MustQuery("select @@session.tidb_opt_prefer_range_scan").Check(testkit.Rows("1")) + tk.MustExec("set session tidb_opt_prefer_range_scan = 0") + tk.MustQuery("select @@session.tidb_opt_prefer_range_scan").Check(testkit.Rows("0")) } func (s *testSuite5) TestTruncateIncorrectIntSessionVar(c *C) { diff --git a/planner/core/find_best_task.go b/planner/core/find_best_task.go index 97c3617d31be4..d797988d1b639 100644 --- a/planner/core/find_best_task.go +++ b/planner/core/find_best_task.go @@ -624,21 +624,28 @@ func (ds *DataSource) skylinePruning(prop *property.PhysicalProperty) []*candida } if ds.ctx.GetSessionVars().GetAllowPreferRangeScan() && len(candidates) > 1 { - // remove the table/index full scan path - for i, c := range candidates { + // remove table/index full scan paths if there exists some range scan path + preferredPaths := make([]*candidatePath, 0, len(candidates)) + var hasRangeScanPath bool + for _, c := range candidates { + if c.path.Forced || c.path.StoreType == kv.TiFlash { + preferredPaths = append(preferredPaths, c) + continue + } var unsignedIntHandle bool if c.path.IsIntHandlePath && ds.tableInfo.PKIsHandle { if pkColInfo := ds.tableInfo.GetPkColInfo(); pkColInfo != nil { unsignedIntHandle = mysql.HasUnsignedFlag(pkColInfo.Flag) } } - for _, ran := range c.path.Ranges { - if ran.IsFullRange(unsignedIntHandle) { - candidates = append(candidates[:i], candidates[i+1:]...) - return candidates - } + if !ranger.HasFullRange(c.path.Ranges, unsignedIntHandle) { + preferredPaths = append(preferredPaths, c) + hasRangeScanPath = true } } + if hasRangeScanPath { + return preferredPaths + } } return candidates diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index 9d4815312c4d5..8d3a6dd845507 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -33,6 +33,7 @@ import ( "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/sessionctx/variable" + "github.com/pingcap/tidb/statistics/handle" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/util/collate" "github.com/pingcap/tidb/util/testkit" @@ -4207,6 +4208,10 @@ func (s *testIntegrationSuite) TestPreferRangeScanForUnsignedIntHandle(c *C) { tk.MustExec("use test") tk.MustExec("drop table if exists t") tk.MustExec("create table t(a int unsigned primary key, b int, c int, index idx_b(b))") + tk.MustExec("insert into t values (1,2,3), (4,5,6), (7,8,9), (10,11,12), (13,14,15)") + do, _ := session.GetDomain(s.store) + c.Assert(do.StatsHandle().DumpStatsDeltaToKV(handle.DumpAll), IsNil) + tk.MustExec("analyze table t") var input []string var output []struct { @@ -4216,6 +4221,13 @@ func (s *testIntegrationSuite) TestPreferRangeScanForUnsignedIntHandle(c *C) { } s.testData.GetTestCases(c, &input, &output) for i, tt := range input { + s.testData.OnRecord(func() { + output[i].SQL = tt + }) + if strings.HasPrefix(tt, "set") { + tk.MustExec(tt) + continue + } s.testData.OnRecord(func() { output[i].SQL = tt output[i].Plan = s.testData.ConvertRowsToStrings(tk.MustQuery(tt).Rows()) diff --git a/planner/core/testdata/integration_partition_suite_out.json b/planner/core/testdata/integration_partition_suite_out.json index 5237f3bfc3e14..c8eb3874fe516 100644 --- a/planner/core/testdata/integration_partition_suite_out.json +++ b/planner/core/testdata/integration_partition_suite_out.json @@ -1021,11 +1021,11 @@ ] }, { - "SQL": "create table tto_seconds (a date, b datetime) partition by list (TO_SECONDS(a)) (partition p0 values in (0, 1, 2, 3, 63745012800), partition p1 values in (4, 5, 6, 7, 63744969600))", + "SQL": "create table tto_seconds (a date, b datetime) partition by list (TO_SECONDS(a)) (partition p0 values in (0, 1, 2, 3, 63740649600), partition p1 values in (4, 5, 6, 7, 63744969600))", "Results": null }, { - "SQL": "insert into tto_seconds values ('2019-12-31 12:00:00', '2019-12-31 23:59:59'), ('2019-12-31 23:06:59', '2019-12-31 12:00:00')", + "SQL": "insert into tto_seconds values ('2019-12-31 12:00:00', '2019-12-31 23:59:59'), ('2019-11-11 23:06:59', '2019-12-31 12:00:00')", "Results": null }, { diff --git a/planner/core/testdata/integration_suite_in.json b/planner/core/testdata/integration_suite_in.json index 21142150bf17e..b3aa402e11c8c 100644 --- a/planner/core/testdata/integration_suite_in.json +++ b/planner/core/testdata/integration_suite_in.json @@ -347,8 +347,12 @@ "cases": [ "set tidb_opt_prefer_range_scan = 0", "explain format = 'verbose' select * from t where b > 5", + "explain format = 'verbose' select * from t where b = 6 order by a limit 1", + "explain format = 'verbose' select * from t where b = 6 limit 1", "set tidb_opt_prefer_range_scan = 1", - "explain format = 'verbose' select * from t where b > 5" + "explain format = 'verbose' select * from t where b > 5", + "explain format = 'verbose' select * from t where b = 6 order by a limit 1", + "explain format = 'verbose' select * from t where b = 6 limit 1" ] } ] diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index a17c2344d6d1f..f7b58dde870e6 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -1823,6 +1823,27 @@ ], "Warnings": null }, + { + "SQL": "explain format = 'verbose' select * from t where b = 6 order by a limit 1", + "Plan": [ + "TopN_9 1.00 72.74 root test.t.a, offset:0, count:1", + "└─IndexLookUp_20 1.00 69.74 root ", + " ├─TopN_19(Build) 1.00 0.00 cop[tikv] test.t.a, offset:0, count:1", + " │ └─IndexRangeScan_17 10.00 590.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false, stats:pseudo", + " └─TableRowIDScan_18(Probe) 1.00 590.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warnings": null + }, + { + "SQL": "explain format = 'verbose' select * from t where b = 6 limit 1", + "Plan": [ + "IndexLookUp_17 1.00 33.54 root limit embedded(offset:0, count:1)", + "├─Limit_16(Build) 1.00 77.00 cop[tikv] offset:0, count:1", + "│ └─IndexRangeScan_14 1.00 77.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false, stats:pseudo", + "└─TableRowIDScan_15(Probe) 1.00 77.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warnings": null + }, { "SQL": "set tidb_opt_prefer_range_scan = 1", "Plan": null, @@ -1831,13 +1852,38 @@ { "SQL": "explain format = 'verbose' select * from t where b > 5", "Plan": [ - "IndexLookUp_7 3333.33 70785.94 root ", + "IndexLookUp_7 3333.33 70785.94 root ", "├─IndexRangeScan_5(Build) 3333.33 190020.00 cop[tikv] table:t, index:idx_b(b) range:(5,+inf], keep order:false, stats:pseudo", "└─TableRowIDScan_6(Probe) 3333.33 190020.00 cop[tikv] table:t keep order:false, stats:pseudo" ], "Warnings": [ "Note 1105 [idx_b] remain after pruning paths for t given Prop{SortItems: [], TaskTp: rootTask}" ] + }, + { + "SQL": "explain format = 'verbose' select * from t where b = 6 order by a limit 1", + "Plan": [ + "TopN_9 1.00 72.74 root test.t.a, offset:0, count:1", + "└─IndexLookUp_16 1.00 69.74 root ", + " ├─TopN_15(Build) 1.00 0.00 cop[tikv] test.t.a, offset:0, count:1", + " │ └─IndexRangeScan_13 10.00 590.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false, stats:pseudo", + " └─TableRowIDScan_14(Probe) 1.00 590.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warnings": [ + "Note 1105 [idx_b] remain after pruning paths for t given Prop{SortItems: [], TaskTp: copDoubleReadTask}" + ] + }, + { + "SQL": "explain format = 'verbose' select * from t where b = 6 limit 1", + "Plan": [ + "IndexLookUp_13 1.00 33.54 root limit embedded(offset:0, count:1)", + "├─Limit_12(Build) 1.00 77.00 cop[tikv] offset:0, count:1", + "│ └─IndexRangeScan_10 1.00 77.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false, stats:pseudo", + "└─TableRowIDScan_11(Probe) 1.00 77.00 cop[tikv] table:t keep order:false, stats:pseudo" + ], + "Warnings": [ + "Note 1105 [idx_b] remain after pruning paths for t given Prop{SortItems: [], TaskTp: copDoubleReadTask}" + ] } ] } diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index b3627bd10a435..5b1c2eb8b1f45 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -921,7 +921,7 @@ var defaultSysVars = []*SysVar{ s.SetAllowInSubqToJoinAndAgg(TiDBOptOn(val)) return nil }}, - {Scope: ScopeSession, Name: TiDBOptPreferRangeScan, Value: BoolToOnOff(DefOptPreferRangeScan), Type: TypeBool, IsHintUpdatable: true, SetSession: func(s *SessionVars, val string) error { + {Scope: ScopeGlobal | ScopeSession, Name: TiDBOptPreferRangeScan, Value: BoolToOnOff(DefOptPreferRangeScan), Type: TypeBool, IsHintUpdatable: true, SetSession: func(s *SessionVars, val string) error { s.SetAllowPreferRangeScan(TiDBOptOn(val)) return nil }}, From 1b3f79dbdc466e8bc8e34f9d9004ebeb0a1b05de Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Thu, 12 Aug 2021 10:20:12 +0800 Subject: [PATCH 04/13] fmt and upd comment --- planner/core/find_best_task.go | 4 +++- util/ranger/types_test.go | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/planner/core/find_best_task.go b/planner/core/find_best_task.go index d797988d1b639..574a225730ed5 100644 --- a/planner/core/find_best_task.go +++ b/planner/core/find_best_task.go @@ -624,7 +624,9 @@ func (ds *DataSource) skylinePruning(prop *property.PhysicalProperty) []*candida } if ds.ctx.GetSessionVars().GetAllowPreferRangeScan() && len(candidates) > 1 { - // remove table/index full scan paths if there exists some range scan path + // For those paths which are neither TiFlash-path nor forced-path, we remove table/index full scan paths if there + // exists some range scan path. + // For TiFlash-path or forced-path, we just keep them. preferredPaths := make([]*candidatePath, 0, len(candidates)) var hasRangeScanPath bool for _, c := range candidates { diff --git a/util/ranger/types_test.go b/util/ranger/types_test.go index 5b7ffade8c0cb..4a4bf9493a3b3 100644 --- a/util/ranger/types_test.go +++ b/util/ranger/types_test.go @@ -144,7 +144,7 @@ func TestIsFullRange(t *testing.T) { HighVal: []types.Datum{types.NewIntDatum(math.MaxInt64)}, }, unsignedIntHandle: false, - isFullRange: true, + isFullRange: true, }, { ran: ranger.Range{ @@ -152,7 +152,7 @@ func TestIsFullRange(t *testing.T) { HighVal: []types.Datum{types.NewIntDatum(math.MinInt64)}, }, unsignedIntHandle: false, - isFullRange: false, + isFullRange: false, }, { ran: ranger.Range{ @@ -160,7 +160,7 @@ func TestIsFullRange(t *testing.T) { HighVal: []types.Datum{types.NewUintDatum(math.MaxUint64)}, }, unsignedIntHandle: false, - isFullRange: false, + isFullRange: false, }, { ran: ranger.Range{ @@ -168,7 +168,7 @@ func TestIsFullRange(t *testing.T) { HighVal: []types.Datum{types.NewUintDatum(math.MaxUint64)}, }, unsignedIntHandle: false, - isFullRange: true, + isFullRange: true, }, { ran: ranger.Range{ @@ -176,7 +176,7 @@ func TestIsFullRange(t *testing.T) { HighVal: []types.Datum{*nullDatum.Clone()}, }, unsignedIntHandle: false, - isFullRange: false, + isFullRange: false, }, { ran: ranger.Range{ @@ -184,7 +184,7 @@ func TestIsFullRange(t *testing.T) { HighVal: []types.Datum{types.MaxValueDatum()}, }, unsignedIntHandle: false, - isFullRange: true, + isFullRange: true, }, { ran: ranger.Range{ @@ -192,7 +192,7 @@ func TestIsFullRange(t *testing.T) { HighVal: []types.Datum{types.NewUintDatum(math.MaxUint64)}, }, unsignedIntHandle: true, - isFullRange: true, + isFullRange: true, }, } for _, v := range isFullRangeTests { From bd3c97ae143a17496de583e26e9805ee9b579d0f Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Fri, 13 Aug 2021 10:54:31 +0800 Subject: [PATCH 05/13] fix --- util/ranger/types_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/ranger/types_test.go b/util/ranger/types_test.go index 4a4bf9493a3b3..4576ce3f6fd27 100644 --- a/util/ranger/types_test.go +++ b/util/ranger/types_test.go @@ -196,6 +196,6 @@ func TestIsFullRange(t *testing.T) { }, } for _, v := range isFullRangeTests { - require.Equal(t, v.isFullRange, v.ran.IsFullRange(t.unsignedIntHandle)) + require.Equal(t, v.isFullRange, v.ran.IsFullRange(v.unsignedIntHandle)) } } From 23e3a14a676064e602ef9cd59c118c4641640cfa Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Tue, 17 Aug 2021 14:43:40 +0800 Subject: [PATCH 06/13] fix --- cmd/explaintest/r/explain_complex_stats.result | 4 ++-- planner/core/explain.go | 12 ++++++------ planner/core/find_best_task.go | 5 ++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/cmd/explaintest/r/explain_complex_stats.result b/cmd/explaintest/r/explain_complex_stats.result index f9f1922595248..8beb3ffc5a6c5 100644 --- a/cmd/explaintest/r/explain_complex_stats.result +++ b/cmd/explaintest/r/explain_complex_stats.result @@ -131,10 +131,10 @@ Projection 424.00 root test.st.id, test.dd.id, test.st.aid, test.st.cm, test.dd └─HashJoin 424.00 root inner join, equal:[eq(test.st.aid, test.dd.aid) eq(test.st.ip, test.dd.ip)], other cond:gt(test.dd.t, test.st.t) ├─TableReader(Build) 424.00 root data:Selection │ └─Selection 424.00 cop[tikv] eq(test.st.bm, 0), eq(test.st.pt, "android"), gt(test.st.t, 1478143908), not(isnull(test.st.ip)) - │ └─TableRangeScan 1999.00 cop[tikv] table:gad range:[0,+inf], keep order:false + │ └─TableFullScan 1999.00 cop[tikv] table:gad keep order:false └─TableReader(Probe) 450.56 root data:Selection └─Selection 450.56 cop[tikv] eq(test.dd.bm, 0), eq(test.dd.pt, "android"), gt(test.dd.t, 1478143908), not(isnull(test.dd.ip)), not(isnull(test.dd.t)) - └─TableRangeScan 2000.00 cop[tikv] table:dd range:[0,+inf], keep order:false + └─TableFullScan 2000.00 cop[tikv] table:dd keep order:false explain format = 'brief' select gad.id as gid,sdk.id as sid,gad.aid as aid,gad.cm as cm,sdk.dic as dic,sdk.ip as ip, sdk.t as t, gad.p1 as p1, gad.p2 as p2, gad.p3 as p3, gad.p4 as p4, gad.p5 as p5, gad.p6_md5 as p6, gad.p7_md5 as p7, gad.ext as ext from st gad join dd sdk on gad.aid = sdk.aid and gad.dic = sdk.mac and gad.t < sdk.t where gad.t > 1477971479 and gad.bm = 0 and gad.pt = 'ios' and gad.dit = 'mac' and sdk.t > 1477971479 and sdk.bm = 0 and sdk.pt = 'ios' limit 3000; id estRows task access object operator info Projection 170.34 root test.st.id, test.dd.id, test.st.aid, test.st.cm, test.dd.dic, test.dd.ip, test.dd.t, test.st.p1, test.st.p2, test.st.p3, test.st.p4, test.st.p5, test.st.p6_md5, test.st.p7_md5, test.st.ext diff --git a/planner/core/explain.go b/planner/core/explain.go index 7239bec29c475..23eeaff6e8c34 100644 --- a/planner/core/explain.go +++ b/planner/core/explain.go @@ -322,13 +322,13 @@ func (p *PhysicalTableScan) isFullScan() bool { if len(p.rangeDecidedBy) > 0 || p.haveCorCol() { return false } - for _, ran := range p.Ranges { - var unsignedIntHandle bool - if p.Table.PKIsHandle { - if pkColInfo := p.Table.GetPkColInfo(); pkColInfo != nil { - unsignedIntHandle = mysql.HasUnsignedFlag(pkColInfo.Flag) - } + var unsignedIntHandle bool + if p.Table.PKIsHandle { + if pkColInfo := p.Table.GetPkColInfo(); pkColInfo != nil { + unsignedIntHandle = mysql.HasUnsignedFlag(pkColInfo.Flag) } + } + for _, ran := range p.Ranges { if !ran.IsFullRange(unsignedIntHandle) { return false } diff --git a/planner/core/find_best_task.go b/planner/core/find_best_task.go index 35c5828eb61b4..9e1dcee7db4c3 100644 --- a/planner/core/find_best_task.go +++ b/planner/core/find_best_task.go @@ -625,9 +625,8 @@ func (ds *DataSource) skylinePruning(prop *property.PhysicalProperty) []*candida } if ds.ctx.GetSessionVars().GetAllowPreferRangeScan() && len(candidates) > 1 { - // For those paths which are neither TiFlash-path nor forced-path, we remove table/index full scan paths if there - // exists some range scan path. - // For TiFlash-path or forced-path, we just keep them. + // If a candidate path is TiFlash-path or forced-path, we just keep them. For other candidate paths, if there exists + // any range scan path, we remove full scan paths and keep range scan paths. preferredPaths := make([]*candidatePath, 0, len(candidates)) var hasRangeScanPath bool for _, c := range candidates { From 51a7081cbb7a80426121dd8048f4ea16ec40d3d0 Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Wed, 25 Aug 2021 10:33:07 +0800 Subject: [PATCH 07/13] fix explaintest --- cmd/explaintest/r/explain_complex_stats.result | 4 ++-- cmd/explaintest/r/select.result | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/explaintest/r/explain_complex_stats.result b/cmd/explaintest/r/explain_complex_stats.result index 8beb3ffc5a6c5..4365be0c45336 100644 --- a/cmd/explaintest/r/explain_complex_stats.result +++ b/cmd/explaintest/r/explain_complex_stats.result @@ -142,7 +142,7 @@ Projection 170.34 root test.st.id, test.dd.id, test.st.aid, test.st.cm, test.dd └─IndexJoin 170.34 root inner join, inner:IndexLookUp, outer key:test.st.aid, inner key:test.dd.aid, equal cond:eq(test.st.aid, test.dd.aid), eq(test.st.dic, test.dd.mac), other cond:lt(test.st.t, test.dd.t) ├─TableReader(Build) 170.34 root data:Selection │ └─Selection 170.34 cop[tikv] eq(test.st.bm, 0), eq(test.st.dit, "mac"), eq(test.st.pt, "ios"), gt(test.st.t, 1477971479), not(isnull(test.st.dic)) - │ └─TableRangeScan 1999.00 cop[tikv] table:gad range:[0,+inf], keep order:false + │ └─TableFullScan 1999.00 cop[tikv] table:gad keep order:false └─IndexLookUp(Probe) 1.00 root ├─IndexRangeScan(Build) 3.93 cop[tikv] table:sdk, index:aid(aid, dic) range: decided by [eq(test.dd.aid, test.st.aid)], keep order:false └─Selection(Probe) 1.00 cop[tikv] eq(test.dd.bm, 0), eq(test.dd.pt, "ios"), gt(test.dd.t, 1477971479), not(isnull(test.dd.mac)), not(isnull(test.dd.t)) @@ -162,7 +162,7 @@ Projection 428.32 root test.dt.id, test.dt.aid, test.dt.pt, test.dt.dic, test.d └─IndexJoin 428.32 root inner join, inner:IndexLookUp, outer key:test.dt.aid, test.dt.dic, inner key:test.rr.aid, test.rr.dic, equal cond:eq(test.dt.aid, test.rr.aid), eq(test.dt.dic, test.rr.dic) ├─TableReader(Build) 428.32 root data:Selection │ └─Selection 428.32 cop[tikv] eq(test.dt.bm, 0), eq(test.dt.pt, "ios"), gt(test.dt.t, 1478185592), not(isnull(test.dt.dic)) - │ └─TableRangeScan 2000.00 cop[tikv] table:dt range:[0,+inf], keep order:false + │ └─TableFullScan 2000.00 cop[tikv] table:dt keep order:false └─IndexLookUp(Probe) 1.00 root ├─IndexRangeScan(Build) 1.00 cop[tikv] table:rr, index:PRIMARY(aid, dic) range: decided by [eq(test.rr.aid, test.dt.aid) eq(test.rr.dic, test.dt.dic)], keep order:false └─Selection(Probe) 1.00 cop[tikv] eq(test.rr.pt, "ios"), gt(test.rr.t, 1478185592) diff --git a/cmd/explaintest/r/select.result b/cmd/explaintest/r/select.result index c69a29bd4a963..15b71d0e65166 100644 --- a/cmd/explaintest/r/select.result +++ b/cmd/explaintest/r/select.result @@ -478,8 +478,8 @@ id estRows task access object operator info Projection 10000.00 root minus(Column#5, test.t.x)->Column#7 └─Window 10000.00 root row_number()->Column#5 over(partition by test.t.i rows between current row and current row) └─Sort 10000.00 root test.t.i - └─TableReader 10000.00 root data:TableRangeScan - └─TableRangeScan 10000.00 cop[tikv] table:t range:[0,+inf], keep order:false, stats:pseudo + └─TableReader 10000.00 root data:TableFullScan + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo create table precise_types ( a BIGINT UNSIGNED NOT NULL, b BIGINT NOT NULL, From f1b7455f4868de412f2bc68aa32dd08523656cec Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Wed, 25 Aug 2021 11:08:16 +0800 Subject: [PATCH 08/13] fix test --- .../core/testdata/integration_suite_out.json | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index bee56c65ec7cb..95592bb9a52fa 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -1895,30 +1895,31 @@ { "SQL": "explain format = 'verbose' select * from t where b > 5", "Plan": [ - "TableReader_7 3333.33 45418.00 root data:Selection_6", - "└─Selection_6 3333.33 600020.00 cop[tikv] gt(test.t.b, 5)", - " └─TableFullScan_5 10000.00 570020.00 cop[tikv] table:t keep order:false, stats:pseudo" + "TableReader_7 3.00 19.21 root data:Selection_6", + "└─Selection_6 3.00 215.00 cop[tikv] gt(test.t.b, 5)", + " └─TableFullScan_5 5.00 200.00 cop[tikv] table:t keep order:false" ], "Warnings": null }, { "SQL": "explain format = 'verbose' select * from t where b = 6 order by a limit 1", "Plan": [ - "TopN_9 1.00 72.74 root test.t.a, offset:0, count:1", - "└─IndexLookUp_20 1.00 69.74 root ", - " ├─TopN_19(Build) 1.00 0.00 cop[tikv] test.t.a, offset:0, count:1", - " │ └─IndexRangeScan_17 10.00 590.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false, stats:pseudo", - " └─TableRowIDScan_18(Probe) 1.00 590.00 cop[tikv] table:t keep order:false, stats:pseudo" + "Limit_11 0.00 14.33 root offset:0, count:1", + "└─TableReader_24 0.00 14.33 root data:Limit_23", + " └─Limit_23 0.00 215.00 cop[tikv] offset:0, count:1", + " └─Selection_22 0.00 215.00 cop[tikv] eq(test.t.b, 6)", + " └─TableFullScan_21 5.00 200.00 cop[tikv] table:t keep order:true" ], "Warnings": null }, { "SQL": "explain format = 'verbose' select * from t where b = 6 limit 1", "Plan": [ - "IndexLookUp_17 1.00 33.54 root limit embedded(offset:0, count:1)", - "├─Limit_16(Build) 1.00 77.00 cop[tikv] offset:0, count:1", - "│ └─IndexRangeScan_14 1.00 77.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false, stats:pseudo", - "└─TableRowIDScan_15(Probe) 1.00 77.00 cop[tikv] table:t keep order:false, stats:pseudo" + "Limit_8 0.00 14.33 root offset:0, count:1", + "└─TableReader_13 0.00 14.33 root data:Limit_12", + " └─Limit_12 0.00 215.00 cop[tikv] offset:0, count:1", + " └─Selection_11 0.00 215.00 cop[tikv] eq(test.t.b, 6)", + " └─TableFullScan_10 5.00 200.00 cop[tikv] table:t keep order:false" ], "Warnings": null }, @@ -1930,9 +1931,9 @@ { "SQL": "explain format = 'verbose' select * from t where b > 5", "Plan": [ - "IndexLookUp_7 3333.33 70785.94 root ", - "├─IndexRangeScan_5(Build) 3333.33 190020.00 cop[tikv] table:t, index:idx_b(b) range:(5,+inf], keep order:false, stats:pseudo", - "└─TableRowIDScan_6(Probe) 3333.33 190020.00 cop[tikv] table:t keep order:false, stats:pseudo" + "IndexLookUp_7 3.00 64.81 root ", + "├─IndexRangeScan_5(Build) 3.00 191.00 cop[tikv] table:t, index:idx_b(b) range:(5,+inf], keep order:false", + "└─TableRowIDScan_6(Probe) 3.00 191.00 cop[tikv] table:t keep order:false" ], "Warnings": [ "Note 1105 [idx_b] remain after pruning paths for t given Prop{SortItems: [], TaskTp: rootTask}" @@ -1941,11 +1942,11 @@ { "SQL": "explain format = 'verbose' select * from t where b = 6 order by a limit 1", "Plan": [ - "TopN_9 1.00 72.74 root test.t.a, offset:0, count:1", - "└─IndexLookUp_16 1.00 69.74 root ", - " ├─TopN_15(Build) 1.00 0.00 cop[tikv] test.t.a, offset:0, count:1", - " │ └─IndexRangeScan_13 10.00 590.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false, stats:pseudo", - " └─TableRowIDScan_14(Probe) 1.00 590.00 cop[tikv] table:t keep order:false, stats:pseudo" + "TopN_9 0.00 19.34 root test.t.a, offset:0, count:1", + "└─IndexLookUp_16 0.00 19.33 root ", + " ├─TopN_15(Build) 0.00 0.00 cop[tikv] test.t.a, offset:0, count:1", + " │ └─IndexRangeScan_13 0.00 20.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false", + " └─TableRowIDScan_14(Probe) 0.00 20.00 cop[tikv] table:t keep order:false, stats:pseudo" ], "Warnings": [ "Note 1105 [idx_b] remain after pruning paths for t given Prop{SortItems: [], TaskTp: copDoubleReadTask}" @@ -1954,10 +1955,10 @@ { "SQL": "explain format = 'verbose' select * from t where b = 6 limit 1", "Plan": [ - "IndexLookUp_13 1.00 33.54 root limit embedded(offset:0, count:1)", - "├─Limit_12(Build) 1.00 77.00 cop[tikv] offset:0, count:1", - "│ └─IndexRangeScan_10 1.00 77.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false, stats:pseudo", - "└─TableRowIDScan_11(Probe) 1.00 77.00 cop[tikv] table:t keep order:false, stats:pseudo" + "IndexLookUp_13 0.00 19.33 root limit embedded(offset:0, count:1)", + "├─Limit_12(Build) 0.00 20.00 cop[tikv] offset:0, count:1", + "│ └─IndexRangeScan_10 0.00 20.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false", + "└─TableRowIDScan_11(Probe) 0.00 20.00 cop[tikv] table:t keep order:false, stats:pseudo" ], "Warnings": [ "Note 1105 [idx_b] remain after pruning paths for t given Prop{SortItems: [], TaskTp: copDoubleReadTask}" From acfbace568163dfec7bfc291ae9422b4a3d565cc Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Wed, 25 Aug 2021 11:20:14 +0800 Subject: [PATCH 09/13] fix ut --- executor/executor_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executor/executor_test.go b/executor/executor_test.go index a078c8c68e517..019d4a018c176 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -5623,7 +5623,7 @@ func (s *testSerialSuite2) TestUnsignedFeedback(c *C) { tk.MustQuery("select count(distinct b) from t").Check(testkit.Rows("2")) result := tk.MustQuery("explain analyze select count(distinct b) from t") c.Assert(result.Rows()[2][4], Equals, "table:t") - c.Assert(result.Rows()[2][6], Equals, "range:[0,+inf], keep order:false") + c.Assert(result.Rows()[2][6], Equals, "keep order:false") } func (s *testSerialSuite2) TestIssue23567(c *C) { From f829ae4224a02e0c4b21fd5a98aea43f4ecf3e5e Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Wed, 25 Aug 2021 13:47:57 +0800 Subject: [PATCH 10/13] fix ut --- util/ranger/testdata/ranger_suite_out.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/ranger/testdata/ranger_suite_out.json b/util/ranger/testdata/ranger_suite_out.json index fb40fffb6fe48..d6a9769cc97b8 100644 --- a/util/ranger/testdata/ranger_suite_out.json +++ b/util/ranger/testdata/ranger_suite_out.json @@ -366,7 +366,7 @@ "Plan": [ "TableReader_7 1.00 root data:Selection_6", "└─Selection_6 1.00 cop[tikv] eq(test.t2.t, \"aaaa\")", - " └─TableRangeScan_5 2.00 cop[tikv] table:t2 range:[0,+inf], keep order:false" + " └─TableFullScan_5 2.00 cop[tikv] table:t2 keep order:false" ], "Result": [ "1 aaaa" @@ -377,7 +377,7 @@ "Plan": [ "TableReader_7 1.60 root data:Selection_6", "└─Selection_6 1.60 cop[tikv] or(eq(test.t2.t, \"aaaa\"), eq(test.t2.t, \"a\"))", - " └─TableRangeScan_5 2.00 cop[tikv] table:t2 range:[0,+inf], keep order:false" + " └─TableFullScan_5 2.00 cop[tikv] table:t2 keep order:false" ], "Result": [ "1 aaaa", From 02b64525bad8157cf605555054f5ed1676531529 Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Wed, 1 Sep 2021 10:37:00 +0800 Subject: [PATCH 11/13] fix --- planner/core/testdata/integration_suite_in.json | 1 - 1 file changed, 1 deletion(-) diff --git a/planner/core/testdata/integration_suite_in.json b/planner/core/testdata/integration_suite_in.json index ba11782dd8ca3..b67cc1ffbf4e6 100644 --- a/planner/core/testdata/integration_suite_in.json +++ b/planner/core/testdata/integration_suite_in.json @@ -380,7 +380,6 @@ "select * from (select @n:=@n+a as e from ta) tt group by e", "select a from ta group by @n:=@n+1", "select a from ta group by @n:=@n+a" ->>>>>>> master ] } ] From a7dc6b44246ad8ed5599fecf1ed0785ebddf5b05 Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Wed, 1 Sep 2021 10:51:07 +0800 Subject: [PATCH 12/13] fix ut --- planner/core/testdata/integration_suite_out.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index 437fc17ffd0cd..459e8172f773e 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -1946,7 +1946,7 @@ "└─IndexLookUp_16 0.00 19.33 root ", " ├─TopN_15(Build) 0.00 0.00 cop[tikv] test.t.a, offset:0, count:1", " │ └─IndexRangeScan_13 0.00 20.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false", - " └─TableRowIDScan_14(Probe) 0.00 20.00 cop[tikv] table:t keep order:false, stats:pseudo" + " └─TableRowIDScan_14(Probe) 0.00 20.00 cop[tikv] table:t keep order:false" ], "Warnings": [ "Note 1105 [idx_b] remain after pruning paths for t given Prop{SortItems: [], TaskTp: copDoubleReadTask}" From 700c291e4abff9a0337cdbef1eb2d9b52ecb9b85 Mon Sep 17 00:00:00 2001 From: xuyifan <675434007@qq.com> Date: Wed, 1 Sep 2021 12:56:58 +0800 Subject: [PATCH 13/13] fix ut --- planner/core/testdata/integration_suite_out.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index 459e8172f773e..47fb9e613358d 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -1958,7 +1958,7 @@ "IndexLookUp_13 0.00 19.33 root limit embedded(offset:0, count:1)", "├─Limit_12(Build) 0.00 20.00 cop[tikv] offset:0, count:1", "│ └─IndexRangeScan_10 0.00 20.00 cop[tikv] table:t, index:idx_b(b) range:[6,6], keep order:false", - "└─TableRowIDScan_11(Probe) 0.00 20.00 cop[tikv] table:t keep order:false, stats:pseudo" + "└─TableRowIDScan_11(Probe) 0.00 20.00 cop[tikv] table:t keep order:false" ], "Warnings": [ "Note 1105 [idx_b] remain after pruning paths for t given Prop{SortItems: [], TaskTp: copDoubleReadTask}"