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

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

Jun 13, 2016 pm 01:31 PM
join left

帮忙看下这个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 of this Website
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use JOIN in MySql How to use JOIN in MySql Jun 04, 2023 am 08:02 AM

How to use JOIN in MySql

Which key is left on the keyboard? Which key is left on the keyboard? Mar 13, 2023 pm 02:27 PM

Which key is left on the keyboard?

What is the usage principle of MySQL Join? What is the usage principle of MySQL Join? May 26, 2023 am 10:07 AM

What is the usage principle of MySQL Join?

What are mysql's join query and multiple query methods? What are mysql's join query and multiple query methods? Jun 02, 2023 pm 04:29 PM

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

How to use JOIN in MySQL How to use JOIN in MySQL Jun 03, 2023 am 09:30 AM

How to use JOIN in MySQL

Use MySQL's JOIN function to join tables Use MySQL's JOIN function to join tables Jul 26, 2023 am 08:37 AM

Use MySQL's JOIN function to join tables

Interpretation of CSS positioning properties: position and top/left/right/bottom Interpretation of CSS positioning properties: position and top/left/right/bottom Oct 21, 2023 am 09:58 AM

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

How to optimize the join statement in MySQL How to optimize the join statement in MySQL Jun 03, 2023 am 09:31 AM

How to optimize the join statement in MySQL

See all articles