You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
testKit.MustExec("insert into t values (1, 1, 1)")
296
+
testKit.MustExec("insert into t select mod(a,250), mod(a,10), mod(a,100) from (with recursive x as (select 1 as a union all select a + 1 AS a from x where a < 500) select a from x) as subquery")
297
+
testKit.MustExec("analyze table t")
298
+
testKit.MustExec("create index idxb on t(b)")
299
+
// Create index after ANALYZE. SkyLine pruning should ensure that idxa is chosen because it has statistics
300
+
testKit.MustQuery("explain format='brief' select * from t where a = 5 and b = 5").CheckContain("idxa(a)")
301
+
testKit.MustExec("analyze table t")
302
+
// idxa should still win after statistics
303
+
testKit.MustQuery("explain format='brief' select * from t where a = 5 and b = 5").CheckContain("idxa(a)")
304
+
testKit.MustExec("create index idxab on t(a, b)")
305
+
// New index idxab should win due to having the most matching equal predicates - regardless of no statistics
306
+
testKit.MustQuery("explain format='brief' select * from t where a = 5 and b = 5").CheckContain("idxab(a, b)")
0 commit comments