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)")
353
+
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")
354
+
testKit.MustExec("analyze table t")
355
+
testKit.MustExec("create index idxb on t(b)")
356
+
// Create index after ANALYZE. SkyLine pruning should ensure that idxa is chosen because it has statistics
357
+
testKit.MustQuery("explain format='brief' select * from t where a = 5 and b = 5").CheckContain("idxa(a)")
358
+
testKit.MustExec("analyze table t")
359
+
// idxa should still win after statistics
360
+
testKit.MustQuery("explain format='brief' select * from t where a = 5 and b = 5").CheckContain("idxa(a)")
361
+
testKit.MustExec("create index idxab on t(a, b)")
362
+
// New index idxab should win due to having the most matching equal predicates - regardless of no statistics
363
+
testKit.MustQuery("explain format='brief' select * from t where a = 5 and b = 5").CheckContain("idxab(a, b)")
0 commit comments