MySQL Forums
Forum List  »  Performance

Re: which is best for JOIN approach
Posted by: Rick James
Date: November 29, 2015 11:53AM

LEFT has a semantic meaning. Decide whether you need it. Don't use LEFT unless you need it to get optional info from the 'righthand' table.

Run EXPLAIN SELECT on those two queries to see what (if any) difference there is.

In my experience, only one JOIN in a thousand needs parentheses. Virtually all cases are happy without them.

If you are trying to say

select ...
    from inform a
    left join (
        SELECT ... FROM infmrq b JOIN contact ec on b.id=ec.id) on b.id=a.id
              ) AS bec ON ...
then that is quite a different case. And it _probably_ has performance issues because of "LEFT JOIN ( SELECT ... )". Again, if you don't need LEFT, don't include it.

Options: ReplyQuote


Subject
Views
Written By
Posted
1449
November 24, 2015 09:39AM
914
November 25, 2015 02:42AM
Re: which is best for JOIN approach
882
November 29, 2015 11:53AM
825
February 19, 2016 05:28AM
765
February 21, 2016 04:56PM
808
February 19, 2016 05:31AM
725
February 21, 2016 01:40PM
768
February 21, 2016 01:43PM
788
February 25, 2016 05:50AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.