mysql 语句优化

佰亿互联 发布于 2015/12/29 20:26
阅读 165
收藏 0

MySQL连接为什么挂死了?别踩坑!>>>


SELECT t_goods.id, t_goods.url, t_goods.recommend, t_goods.market_price, t_goods.fixed_price, t_goods.cost_price, t_goods.sales_price, t_goods.min_price, t_goods.max_price, t_goods.status_id, t_goods.comments_count, t_status.description status_name, t_goods.goods_language_id, t_goods_language.name, t_goods.image_id, t_image.url image_url  
FROM t_goods  
LEFT JOIN t_goods_language ON t_goods_language.goods_id=t_goods.id  
LEFT JOIN t_image ON t_image.id=t_goods.image_id  
LEFT JOIN t_status ON t_status.id=t_goods.status_id  
LEFT JOIN t_category ON t_category.id=t_goods.category_id  
WHERE t_category.family LIKE '1,%'  AND t_goods.status_id='GOODS_SHELF'  AND t_goods_language.language_id=2  ORDER BY t_goods.rec_create_datetime DESC limit 0, 40;
mysql 是5.1版,t_goods, t_goods_language数据大概各有2万条,t_image数据大概有60万,t_category数据不到5千,t_goods 也建了image_id,status_id,category_id相应的索引,现在这个查询基本在1秒左右





加载中
0
pleatu
pleatu

解释计划贴一下。

返回顶部
顶部