Home  >  Article  >  Backend Development  >  帮忙看下这个mysql语句要如何优化

帮忙看下这个mysql语句要如何优化

WBOY
WBOYOriginal
2016-06-13 13:31:36806browse

帮忙看下这个mysql语句要怎么优化
explain select SQL_CALC_FOUND_ROWS d.id,d.goodlevel,d.ismainfield,d.lirun,d.introduce,d.shen,d.city,d.mainfield,d.charges,d.type,m.indentity,m.nick as name,m.username,d.cxt_num,v.vnum 
from tab1 as d left join tab2 as m on d.id=m.uid left join tab3 as v on d.id=v.uid order by d.goodlevel desc,d.cxt_num desc,v.vnum desc limit 10,10

------解决方案--------------------
不知道你的业务,不好改。上面说到索引,其实你这现在这个语句加不加索引也一样


from tab1 as d left join

==========================
d是左表,肯定是全表扫的。你的考虑下你的实际情况是不是需要tab1的整表数据。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn