求大神解决一下这个有关索引使用的问题:
select tric.reg_info_id,
wmsys.wm_concat((select t.name
from T_COMM_CODE t
where t.pid = tpcc.REG_TRADE_TYPE_NUM)) as zczy
from T_PERSON_CERTIFICATE tpcc, T_REG_INFO_CERT tric
where tpcc.id = tric.cert_id
and tpcc.type_code = '402880482672d83e012673e744ff0113'
and tric.state = '1'
and tric.examine_flag = '1'
group by tric.reg_info_id
tpcc.id、tric.cert_id、tpcc.type_code、tric.state、tric.examine_flag这些字段我都已经加上了索引,但是通过执行计划查看T_PERSON_CERTIFICATE和T_REG_INFO_CERT两个表的索引都没有用上
在只查询T_REG_INFO_CERT表的时候发现当使用state = '1'和tric.examine_flag = '1'作为查询条件的时候也用不上索引
select tric.reg_info_id
from T_REG_INFO_CERT tric
where tric.state = '1' and tric.examine_flag = '1'
但是如果tric.examine_flag = '0',又莫名其妙的用上了索引,“1”和“0”数据量几乎是一样大的
select tric.reg_info_id
from T_REG_INFO_CERT tric
where tric.state = '1' and tric.examine_flag = '0'
求救