Subject Re: [firebird-support] Table Scans and !=
Author Helen Borrie
At 04:19 PM 4/08/2003 -0700, you wrote:
>Is it pretty common knowledge that != on a field always does a table
>scan?
>
>
>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!

h.