我有一个表A,有字段a,b,c,d,e,f,g;我以字段a进行范围分区,分了有10个区,每个区里有数据大概600万条数据左右,我常用的检索语句如下:
select * from A where a = a1 order by b;select * from A where b between b1 and b2;select * from A where c between c1 and c2 and b between b1 and b2;select * from A where c between c1 and c2 and d between d1 and d2 and b between b1 and b2;select * from A where c between c1 and c2 and d between d1 and d2 and e between e1 and e2 and b between b1 and b2;就是字段b是常用的检索字段,但字段c,d,e,f,g等有时候用,有时候不用,用的时候也是任意几个的组合检索,
请问我在该表上应该怎么建立索引才最有效,速度最快啊? 是应该建立全局索引还是本地索引啊?