List:General Discussion« Previous MessageNext Message »
From:Perrin Harkins Date:February 3 2009 6:46pm
Subject:Re: WHERE vs. ON
View as plain text  
On Tue, Feb 3, 2009 at 12:24 PM, Jerry Schwartz
<jschwartz@stripped> wrote:
> Somebody, I think it was somebody from MySQL, said that you should never put
> anything into a WHERE clause that could be put into the ON clause of a JOIN.
> My guess is that this helps with the optimization, but it seems
> counter-intuitive to me.

It seems like it shouldn't make any difference if the optimizer is
smart enough, but in my experience it sometimes does.  Because of
that, I always try to put conditions in the ON clauses when I can,
even if they are not about joining the tables.

- Perrin
Thread
WHERE vs. ONJerry Schwartz3 Feb
  • RE: WHERE vs. ONMartin Gainty3 Feb
    • RE: WHERE vs. ONJerry Schwartz3 Feb
      • Re: WHERE vs. ONRob Wultsch3 Feb
  • Re: WHERE vs. ONPerrin Harkins3 Feb
  • Re: WHERE vs. ONBaron Schwartz4 Feb
    • RE: WHERE vs. ONJerry Schwartz4 Feb
    • Re: WHERE vs. ONJohn Daisley4 Feb
      • RE: WHERE vs. ONJerry Schwartz4 Feb
    • Re: WHERE vs. ONClaudio Nanni4 Feb
  • Re: WHERE vs. ONMartijn Tonies4 Feb