Subject Re: [firebird-support] Re: Firebird 2.1.3 optimizer does not use index
Author unordained
---------- Original Message -----------
From: "Andreas Rulle" <intermoves@...>
> If the datatypes of the attributes are equal then the optimizer in
> Firebird 2.1.3 does use the same indices as it has done in the older
> Firebird versions:
>
> If s1 is of type Integer as in
> create table T2 (s1 Integer, s2 varchar(50));
> then the left join
> select t1.s1 from t1 left join t2 on t1.s1=t2.s1
> uses the index
> PLAN JOIN (T1 NATURAL, T2 INDEX (IDX_T12))
------- End of Original Message -------

Without changing the field type, you could create an expression index on the
computed-by value of cast(s1 as integer), but you'd have to use that same
expression in your join, I think, for the optimizer to use it? Not the most
convenient thing, if changing the datatype is a workable solution.

-Philip