mysql - efficiency issues of inner join and left join
学习ing
学习ing 2017-06-24 09:41:36
0
2
1808

Under what circumstances will the execution efficiency of inner join and left join be relatively high?

学习ing
学习ing

reply all(2)
洪涛

Left join will not be more efficient than inner join in any scenario, because in addition to the result set of all inner join, left join also needs all the unassociated data in the left table

In addition to requiring the associated fields to have indexes, left join is best to use a small table as the left table, because the number of retrieval cycles is fewer. The premise is that your business logic is OK, because different writing methods have different logics

Inner join will automatically select the appropriate table as the base table, and it still requires related field indexes, and it is best to use int type retrieval for higher efficiency

迷茫

To be honest, the direction you asked the question is not quite right. . .
It’s just the restriction conditions and indexes, but the query is reasonable, and the speed is very fast
inner join is not based on anyone, it displays the data that meets the conditions
left join is based on the left, and connects the right table

In terms of efficiency, it is definitely faster to connect a small table to a large table
Deepen your understanding of the query plan from a MySQL left join optimization example

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template