我的表有400万数据,以下的查询,达到了28秒,其中Sending data为27秒以上,不知是啥原因哦!
districtlist已建索引,以下是查询语句:
select `phone`,`seat` from `numbers` where `districtlist`=3 order by `porder` asc limit 101182
...全文
24612打赏收藏
mysql查询慢
我的表有400万数据,以下的查询,达到了28秒,其中Sending data为27秒以上,不知是啥原因哦! districtlist已建索引,以下是查询语句: select `phone`,`seat` from `numbers` where `districtlist`=3 order by `porder` asc limit 101182
1:整理下业务,你真的需要101182条记录么?
select `phone`,`seat` from `numbers` where `districtlist`=3 order by `porder` asc limit 101182
2:查询计划已经使用了索引,但是需要扫描的行还是很多,
select count(distinct(districtlist))/count(*) from `numbers`;
看看这个字段的唯一性怎么样
3:show create table `numbers`;
贴出来看看。