Subject | indexing NULL and NOT NULL values |
---|---|
Author | Radu Sky |
Post date | 2006-02-14T20:03:13Z |
Hello,
I have a table with a field that has about 20% not null values and 80%
null and I want to select the not null values with a help of an index.
However, if I
SELECT my_field FROM my_table WHERE my_field IS NOT NULL
the optimizer use natural, no matter that I set the index ascending or
descending. I think that it should normally use it, given that there are
far less values for not null.
SELECT my_field FROM my_table WHERE my_field IS NULL
use that index.
Is this a normal behavior?
TIA
Radu
I have a table with a field that has about 20% not null values and 80%
null and I want to select the not null values with a help of an index.
However, if I
SELECT my_field FROM my_table WHERE my_field IS NOT NULL
the optimizer use natural, no matter that I set the index ascending or
descending. I think that it should normally use it, given that there are
far less values for not null.
SELECT my_field FROM my_table WHERE my_field IS NULL
use that index.
Is this a normal behavior?
TIA
Radu