|
发表于 2013-4-15 10:03:34
|
显示全部楼层
好久没来逛逛了。
mysql> SELECT * FROM goods
-> JOIN goodsatt ON
-> (goods.goodsid=goodsatt.goodsid)
-> WHERE goodsatt.cid IN(101,200,201,202,203,204,205)
-> LIMIT 110020,10;
给你这个语句提点建议:
1.确保索引:goodsid,cid
2.LIMIT 110020,10;这个地方至少要扫描110020条记录,建议使用覆盖索引查询:
select * from goods join (select goodsid from goods where ci in(...) limit ...) as gd2 using(goodsid) |
|