Subject | Re: [firebird-support] Index not used by "where xxx not null" query? |
---|---|
Author | Kjell Rilbe |
Post date | 2006-02-27T13:57:31Z |
Helen Borrie wrote:
What I don't understand why it's not the same for "is null" and "is not
null". Note: this holds true no matter what the percentage of records
with null is.
Kjell
--
--------------------------------------
Kjell Rilbe
Adressmarknaden AM AB
E-post: kjell.rilbe@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64
> At 12:24 AM 28/02/2006, you wrote:OK, I understand, but why DOES the "is null" query use the index then?
>
> Regardless of the selectivity, the index is no use for a NULL/NOT
> NULL selection. It doesn't care what the value is for this test -
> it's only interested in whether there IS a value. (Remember, NULL
> and NOT NULL are not values).
>
> So it would be slower for it to fetch the index than to walk the set
> and form the stream directly.
What I don't understand why it's not the same for "is null" and "is not
null". Note: this holds true no matter what the percentage of records
with null is.
Kjell
--
--------------------------------------
Kjell Rilbe
Adressmarknaden AM AB
E-post: kjell.rilbe@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64