关联查询优化
有表 a
bh ..... hm1 hm2 zt.....
=======================
1 111 000 0
2 111 333 0
3 222 111 1
4 555 111 0
5 111 000 0
...
bh为主键,hm1,hm2 普通索引,zt作bitmap索引
有表b ,b是a的子表
bh zd1 zd2
====================
1 mmm nnn
2 mmm1 333
3 323 232
4 3ss 3232
5 333 432
bh普通索引
现在要得到所有a表和b表关联的所有hm1 or hm2 反包含于字符串'111,3332,'并且zt=0中的所有记录
现在所写的查询是
select * from a inner join b on a.bh=b.bh where a.zt=0 and (instr('111,3332,',a.hm1)>0 or instr('111,3332,',a.hm2)>0)
但查询速度不快.
不知如何优化,期待中.........