diff --git a/executor/explain_test.go b/executor/explain_test.go index acfe8f1d241c9..01cd918d83a9e 100644 --- a/executor/explain_test.go +++ b/executor/explain_test.go @@ -424,3 +424,21 @@ func TestFix29401(t *testing.T) { ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;`) tk.MustExec(" explain select /*+ inl_hash_join(t1) */ * from tt123 t1 join tt123 t2 on t1.b=t2.e;") } + +func TestIssue35296(t *testing.T) { + store, clean := testkit.CreateMockStore(t) + defer clean() + tk := testkit.NewTestKit(t, store) + tk.MustExec("use test") + tk.MustExec("drop table if exists t") + tk.MustExec("create table t(a int, b int , c int, d int, e int,index ia(a), index ib(b), index ic(c), index idd(d), index ie(e));") + + rows := tk.MustQuery("explain analyze select * from t where a = 10 or b = 30 or c = 10 or d = 1 or e = 90;").Rows() + + require.Contains(t, rows[0][0], "IndexMerge") + require.NotRegexp(t, "^time:0s", rows[1][5]) + require.NotRegexp(t, "^time:0s", rows[2][5]) + require.NotRegexp(t, "^time:0s", rows[3][5]) + require.NotRegexp(t, "^time:0s", rows[4][5]) + require.NotRegexp(t, "^time:0s", rows[5][5]) +} diff --git a/executor/index_merge_reader.go b/executor/index_merge_reader.go index 919aee6f15d86..e3b8e6391f2f5 100644 --- a/executor/index_merge_reader.go +++ b/executor/index_merge_reader.go @@ -820,6 +820,9 @@ func (w *partialIndexWorker) fetchHandles( return count, err } if len(handles) == 0 { + if basicStats != nil { + basicStats.Record(time.Since(start), chk.NumRows()) + } return count, nil } count += int64(len(handles))