Subject RE: [firebird-support] Table Scans and !=
Author Robert DiFalco
Indeed. What I found interesting (and I guess it makes sense once I
think it through) is that:

column != value (or column <> value)

Will almost always perform a table scan (i.e. not use indices) whereas
"column IN (everything possible but value)" does the same logic but uses
the index and performs hugely better.

For us, we don't have even distribution on "triState". It's actually
called "groupableType" and only a few rows will have the "root" type. So
the index helps quite a bit for finding the root node.


-----Original Message-----
From: Paul Vinkenoog [mailto:paul@...]
Sent: Monday, August 04, 2003 5:35 PM
Subject: RE: [firebird-support] Table Scans and !=

Hi Sean,

>> Is it pretty common knowledge that != on a field always does a
>> table scan?
> No!
> In fact, what does != signify? Not equal?

Yes, !- means the same in C as <> in Pascal. Both are recognized by
IB/FB. Kind of weird, actually. (I wonder if both are standard SQL?)

Paul Vinkenoog

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.