Subject Re: [firebird-support] Re: Slow query (unindexed reads)
Author Ann Harrison
2011/6/22 Svein Erling Tysvær <svein.erling.tysvaer@...>:

>>
>>One 'problem' that might be an issue is that the foreign key is not always of the same TYPE. ie the ITEMID >field is an integer that links to ITEMNUMBER  (in the ITEMTBL) that is VARCHAR. It still holds a numeric >value though, and is indexed. The other lookups do not have this issue though, but they don't work either.
>
> Ouch, three NATURALs!
>
> I've never tried joining on fields of different types.

As long as the fields are comparable - meaning your not joining a
floating point number to a date - the optimizer should work on them.
It may be that the order of the left joins leaves no opportunity to
use the indexed terms. As you said, inner joins are much easier for
the optimizer to handle.

Good luck,

Ann