Subject RE: [firebird-support] Re: Why does the optimizer choose NATURAL for this tiny table?
Author Leyne, Sean
> 13.11.2014 14:39, Svein Erling Tysvær wrote:
>
> > D1) ON p.icd10 = t.icd10
> >
> > These change the plan to:
> > PLAN JOIN (MERGE (SORT (JOIN (P NATURAL, G INDEX
> > (I_ICD10_GRUPPE_ICD10))), SORT (JOIN (T KID INDEX
> (U_NPR_KRG_ID_FNRK),
> > T N INDEX (I_NPR_KRG_ID), T T INDEX (I_NPR_TILSTAND_ID_NPR)))), I
> > INDEX (PK_ICD10))
>
> Interesting. The only possible explanation is that the datatypes for
> P.ICD10 and T.ICD10 differ. ICD10 is an expression inside T, so its hard to say
> what the resulting data type is.


Dmitry,

Do you think that a CAST() within T would help?


SET,

What are the p.icd10 and t.icd10 datatypes?


Sean