Subject | Re: [firebird-support] Re: Latest entries on either Date or Batch No. field |
---|---|
Author | Ann Harrison |
Post date | 2012-04-13T18:01:30Z |
On Fri, Apr 13, 2012 at 12:43 PM, venussoftop <venussoftop@...> wrote:
having to do with NULL values and empty result sets. I've understood it
from time to time, but this is not one of those times. So it's not
possible to fold all IN subqueries into EXISTS subqueries. Worse, the NOT
IN defies index optimization.
NOT IN as a programmer trap, to be avoided if at all possible.
Good luck,
Ann
[Non-text portions of this message have been removed]
>There's a semantic difference between NOT IN and the equivalent NOT EXISTS
>
> --- In firebird-support@yahoogroups.com, Svein Erling Tysvær
> <svein.erling.tysvaer@...> wrote:
> > First, I would generally recommend you to forget that it is at all
> possible to use IN (<subselect>). Myself, I occasionally use IN (constant),
> but hardly ever IN (<subselect>) - using EXISTS can normally replace it, is
> sometimes faster and never slower (well, I don't know about the later
> Firebird versions, but would expect there to still be queries that Firebird
> doesn't convert from IN (<subselect>) to EXISTS under the hood).
>
having to do with NULL values and empty result sets. I've understood it
from time to time, but this is not one of those times. So it's not
possible to fold all IN subqueries into EXISTS subqueries. Worse, the NOT
IN defies index optimization.
> Somehow IN comes to my mind first, I am at an intermediate stage where IHaving IN come to mind is not a problem. Just train your mind to think of
> am neither a beginner nor a pro with SELECTs :)
NOT IN as a programmer trap, to be avoided if at all possible.
Good luck,
Ann
[Non-text portions of this message have been removed]