Subject | Re: [firebird-support] Index not used by "where xxx not null" query? |
---|---|
Author | Nando Dessena |
Post date | 2006-02-27T14:02:05Z |
Kjell,
KR> Now at stat 0.004484 (freshly calculated), and not a single null left.
KR> Still the same result regarding the query plans: is null uses the
KR> ascending index but is not null doesn't use neither the ascending, nor
KR> the descending index.
KR> What's going on? I'm sure there's just something I'm missing here...
I don't see anything particularly strange in your case. Equality tests
use indexes, inequality tests don't. Why do you expect is null and is
not null to behave differently?
select * from atable where somefield <> 100 doesn't use an index on
somefield. Does this surprise you?
Perhaps Firebird, internally, could turn "is not null" into the
equivalent of "> null" (assuming nulls are at the beginning of the
index). In this case an index would be used.
Ciao
--
Nando Dessena
http://www.flamerobin.org
KR> Now at stat 0.004484 (freshly calculated), and not a single null left.
KR> Still the same result regarding the query plans: is null uses the
KR> ascending index but is not null doesn't use neither the ascending, nor
KR> the descending index.
KR> What's going on? I'm sure there's just something I'm missing here...
I don't see anything particularly strange in your case. Equality tests
use indexes, inequality tests don't. Why do you expect is null and is
not null to behave differently?
select * from atable where somefield <> 100 doesn't use an index on
somefield. Does this surprise you?
Perhaps Firebird, internally, could turn "is not null" into the
equivalent of "> null" (assuming nulls are at the beginning of the
index). In this case an index would be used.
Ciao
--
Nando Dessena
http://www.flamerobin.org