diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index e2cd9a55b4872..38048d4d30009 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -5118,13 +5118,13 @@ func (s *testIntegrationSuite) TestIndexMergeWarning(c *C) { tk.MustExec("drop table if exists t1") tk.MustExec("create table t1(c1 int, c2 int)") tk.MustExec("select /*+ use_index_merge(t1) */ * from t1 where c1 < 1 or c2 < 1") - warningMsg := "Warning 1105 IndexMerge is inapplicable or disabled. No available filter or access path." + warningMsg := "Warning 1105 IndexMerge is inapplicable or disabled. No available filter or available index." tk.MustQuery("show warnings").Check(testkit.Rows(warningMsg)) tk.MustExec("drop table if exists t1") tk.MustExec("create table t1(c1 int, c2 int, key(c1), key(c2))") tk.MustExec("select /*+ use_index_merge(t1), no_index_merge() */ * from t1 where c1 < 1 or c2 < 1") - warningMsg = "Warning 1105 IndexMerge is inapplicable or disabled. Got no_index_merge hint or switcher is off." + warningMsg = "Warning 1105 IndexMerge is inapplicable or disabled. Got no_index_merge hint or tidb_enable_index_merge is off." tk.MustQuery("show warnings").Check(testkit.Rows(warningMsg)) tk.MustExec("drop table if exists t1") diff --git a/planner/core/stats.go b/planner/core/stats.go index cf79f098e9ac2..4b7ac3e33d00a 100644 --- a/planner/core/stats.go +++ b/planner/core/stats.go @@ -453,11 +453,9 @@ func (ds *DataSource) DeriveStats(childStats []*property.StatsInfo, selfSchema * ds.indexMergeHints = nil var msg string if !isPossibleIdxMerge { - msg = "No available filter or access path." + msg = "No available filter or available index." } else if !sessionAndStmtPermission { - msg = "Got no_index_merge hint or switcher is off." - } else if !needConsiderIndexMerge { - msg = "Got index path or exprs that cannot be pushed." + msg = "Got no_index_merge hint or tidb_enable_index_merge is off." } else if ds.tableInfo.TempTableType == model.TempTableLocal { msg = "Cannot use IndexMerge on temporary table." } else if readFromTableCache { @@ -465,7 +463,7 @@ func (ds *DataSource) DeriveStats(childStats []*property.StatsInfo, selfSchema * } msg = fmt.Sprintf("IndexMerge is inapplicable or disabled. %s", msg) stmtCtx.AppendWarning(errors.Errorf(msg)) - logutil.BgLogger().Info(msg) + logutil.BgLogger().Debug(msg) } return ds.stats, nil } @@ -483,7 +481,7 @@ func (ds *DataSource) generateAndPruneIndexMergePath(indexMergeConds []expressio // With hints and without generated IndexMerge paths if regularPathCount == len(ds.possibleAccessPaths) { ds.indexMergeHints = nil - ds.ctx.GetSessionVars().StmtCtx.AppendWarning(errors.Errorf("IndexMerge is inapplicable or disabled")) + ds.ctx.GetSessionVars().StmtCtx.AppendWarning(errors.Errorf("IndexMerge is inapplicable.")) return nil } // Do not need to consider the regular paths in find_best_task(). diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index 6c946cdac4d2d..c3bbda1ed3f2c 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -1332,7 +1332,7 @@ "└─IndexRangeScan 20.00 cop[tikv] table:tt, index:a(a) range:[10,10], [20,20], keep order:false, stats:pseudo" ], "Warnings": [ - "Warning 1105 IndexMerge is inapplicable or disabled" + "Warning 1105 IndexMerge is inapplicable." ] }, { @@ -1342,7 +1342,7 @@ "└─IndexRangeScan 6666.67 cop[tikv] table:tt, index:a(a) range:[-inf,10), [15,15], (20,+inf], keep order:false, stats:pseudo" ], "Warnings": [ - "Warning 1105 IndexMerge is inapplicable or disabled" + "Warning 1105 IndexMerge is inapplicable." ] } ] diff --git a/session/session_test.go b/session/session_test.go index 4602758eeaa28..d8694348ffe85 100644 --- a/session/session_test.go +++ b/session/session_test.go @@ -5419,7 +5419,7 @@ func (s *testSessionSuite) TestLocalTemporaryTableScan(c *C) { "12 112 1012", "3 113 1003", "14 114 1014", "16 116 1016", "7 117 1007", "18 118 1018", )) - tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1105 IndexMerge is inapplicable or disabled")) + tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1105 IndexMerge is inapplicable or disabled. Cannot use IndexMerge on temporary table.")) } doModify := func() { @@ -5458,7 +5458,7 @@ func (s *testSessionSuite) TestLocalTemporaryTableScan(c *C) { "3 113 1003", "14 114 1014", "7 117 9999", "18 118 1018", "12 132 1012", )) - tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1105 IndexMerge is inapplicable or disabled")) + tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1105 IndexMerge is inapplicable or disabled. Cannot use IndexMerge on temporary table.")) } assertSelectAsUnModified() diff --git a/table/tables/cache_test.go b/table/tables/cache_test.go index 62e48ccd24c94..30a3c20c3af00 100644 --- a/table/tables/cache_test.go +++ b/table/tables/cache_test.go @@ -142,7 +142,7 @@ func TestCacheTableBasicScan(t *testing.T) { "12 112 1012", "3 113 1003", "14 114 1014", "16 116 1016", "7 117 1007", "18 118 1018", )) - tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1105 IndexMerge is inapplicable or disabled")) + tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1105 IndexMerge is inapplicable or disabled. Cannot use IndexMerge on TableCache.")) } assertSelect()