Michael A Chase tech wrote on 12/13/2004, 9:24 AM:
> On 12/13/2004 06:09 AM, Hardy Merrill said: 
> 
> > I realize I'm splitting hairs here, and I'm no database expert, but I'm 
> > curious about your answer to this - wouldn't this be even slightly more 
> > efficient to write the WHERE clause conditions as most restricting 
> > first?  In other words, 
> > 
> >    SELECT feature.id 
> >    FROM   feature, 
> >                   reporter 
> >    WHERE  reporter.attributes_id = ? <=== most restrictive 1st 
> >         AND feature.reporter_id = reporter.id  <=== next most 
> > restrictive 
> > 
> > I was once told (or read?) that it is most efficient to put the most 
> > restrictive conditions first in the WHERE - is that right?  I've always 
> > tended to put my joins towards the end of the WHERE when I have other 
> > criteria that I'm looking for - just curious to know if I've been doing 
> > it wrong. 
> 
> The general answer is that it all depends.  A RDBMS builds its search 
> plans based on a lot of factors; the order of the arguments may or may 
> not be one of them. 
> 
For instance, a long time ago in sybase it mattered.  Now the actual order 
doesn't have that much influence. 
> -- 
> Mac :}) 
> ** I usually forward private questions to the appropriate mail list. ** 
> Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html 
> Give a hobbit a fish and he eats fish for a day. 
> Give a hobbit a ring and he eats fish for an age. 

-- 
Your Friendly Neighborhood DBA,

Chuck 

Reply via email to