Re: Nested query problem
From: Michael A Chase tech (mchase_at_ix.netcom.com)
Date: 12/13/04
- Next message: Chuck Fox: "Re: Nested query problem"
- Previous message: Hardy Merrill: "RE: Nested query problem"
- In reply to: Hardy Merrill: "RE: Nested query problem"
- Next in thread: Chuck Fox: "Re: Nested query problem"
- Reply: Chuck Fox: "Re: Nested query problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 13 Dec 2004 06:24:38 -0800 To: Hardy Merrill <HMerrill@dhcr.state.ny.us>
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.
-- 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.
- Next message: Chuck Fox: "Re: Nested query problem"
- Previous message: Hardy Merrill: "RE: Nested query problem"
- In reply to: Hardy Merrill: "RE: Nested query problem"
- Next in thread: Chuck Fox: "Re: Nested query problem"
- Reply: Chuck Fox: "Re: Nested query problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|