First: select * from table A left join table B on the table A. B=table B.
The second: select * from table A left join (select * from table B where table B. A IN (' 101 ', 102)) on the table A. B=table B.
That is to say, the second method is to think in the left before connection, a first screening, shrink range of records, to connect again; But to find out table in advance of the B column value,
These two methods on the execution efficiency which is better?
CodePudding user response:
This depends on the execution plan,IN addition, the first statement, the last is also want to add the WHERE table b. IN A ()?
CodePudding user response:
Explain the select * from table A left join table B on the table A. B=table B.Explain the select * from table A left join (select * from table B where table B. A IN (' 101 ', 102)) on the table A. B=B.
Look at the two statements the execution plan
CodePudding user response:
Is your current content of the two tables, there is no difference betweenCodePudding user response: