Subject | Re: [firebird-support] Re: indexing NULL and NOT NULL values |
---|---|
Author | Ivan Prenosil |
Post date | 2006-02-16T07:17:47Z |
>>> WHERE my_field >= 0 combined with WHERE my_field IS NULL solved myThis bug is fixed in FB2.
>>> problem, however (to be picky) this solution will not work unless
>>> it is
>>> known an imposed min/max value for <my_field> (which mostly is).
>>
>> Then how about "where field >= 0 or field <= 0"?
>> ________________________________________________________
>
>
> This "where field >= 0 or field <= 0" should do fine, at least in theory.
> I checked the performance analysis with IBExpert and I saw a strange thing.
> The test table had 56 records with 5 nulls, the minimum value was 1.
>
> WHEN my_field IS NULL returned 5 indexed reads
>
> WHEN my_field >0 returned 56 indexed reads (all records). Shouldn't be
> 51 here?
>
> WHEN my_field >4 returned 52 indexed reads and so on.
>
> It appears that the index parses also the null values which in this case
> the index is useful only in IS NULL context, the natural will be
> faster when checking for not null values.
Ivan