sql语句引起的效率问题
有同事说我的sql语句存在效率问题
我原来的语句是:
select a_id form t_a where a_id in (select o_id from t_o where t=3 and s=10)
同事说a_id虽然是主键也是索引,但是并未起到索引作用
经过优化后的语句:
select a_id form t_a where a_id in (select o_id from (select o_id from t_o where t=3 and s=10) t)
各位的看法如何?