帮忙看下这个mysql语句要如何优化
Jun 13, 2016 pm 01:31 PM
帮忙看下这个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的整表数据。

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What is the usage principle of MySQL Join?

What are mysql's join query and multiple query methods?

Use MySQL's JOIN function to join tables

Interpretation of CSS positioning properties: position and top/left/right/bottom

How to optimize the join statement in MySQL
