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 974368307select 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都加了索引了连表查询索引mysql