Subject Re: Query that never ends (Firebird 2.5.3)
Author Dmitry Yemanov
25.02.2015 22:38, martin_gorriti@... wrote:
>
> I have this SQL:
>
> select t1.*, t2.* from
>
> (select a1."BJAR",a1."TKEY",a2."OWNR",a2."TIPO",a2."DSCR" as "ADSCR"
> from "TL1_1" a1 left outer join "BJAR" a2 on a1."BJAR"=a2."BJAR") t1
>
> left outer join
>
> (select b1."BJTX",b1."TKEYT",b2."OWNR" as
> "TOWNR",b2."BJAR",b2."DSCR" as "TDSCR",b2."VOCE",b2."RICH",b2."TEXT"
> from "TL1_2" b1 left outer join "BJTX" b2 on b1."BJTX"=b2."BJTX"
> order by "BJAR") t2
>
> on t1."BJAR"=t2."BJAR"
>
> order by t1."TKEY",t2."TKEYT"

Please show us the query plan.
BTW, I don't think you really need ORDER BY inside t2.


Dmitry