两个sql语句含义相同,不过一个慢一个快,哪位大神解释下
我刚睡醒 2013-10-05 02:34:10 select a.ip,b.province from orderip a
inner join ip_address b on a.ip between b.startip and b.endip;
where a.ip between 974034371 and 974368307
select a.ip,b.province from (
select ip from orderip
where ip between 974034371 and 974368307) a
inner join ip_address b on a.ip between b.startip and b.endip;
以上两个SQL语句在Mysql中运行,第一个运行时间比较久,第二个很快,谁能解释下
注释:ip,province,startip,endip都加了索引了