Subject RE: [firebird-support] Table Scans and !=
Author Robert DiFalco
Well, in a black box world, I can't really do "< 2", but I can
substitute "!=" with an "IN" of everything but the value I was going to
compare "!=" to.

Why shouldn't I have triState indexed? In IBExpert the query seems to be
using the index if I use "IN (0,2)" but not if I use "!=1".

As always, thanks for your help.

-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Monday, August 04, 2003 4:34 PM
Subject: Re: [firebird-support] Table Scans and !=

At 04:19 PM 4/08/2003 -0700, you wrote:
>Is it pretty common knowledge that != on a field always does a table
>For example, it seems better to do this:
> SELECT * FROM SomeTable WHERE triState IN ( 0, 1 );

Yup, that's a correct use of the IN(..) predicate.

>Than it is to do:
> SELECT * FROM SomeTable WHERE triState != 2;
>Anyway, my queries are a lot faster now that I moved to the first form.

This might be faster:

SELECT * FROM SomeTable WHERE triState < 2 ;

I hope you don't have triState indexed!


Yahoo! Groups Sponsor

To unsubscribe from this group, send an email to:

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.