Subject Query that never ends (Firebird 2.5.3)
Author

Hi all;


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"

With FlameRobin:

If I only run for searching t1 part, it works super-fast. The same if I run for searching t2 part; but if I run this whole command, Firebird 2.5.3 accepts it, but it never finish (I mean, I waitted more than 20 minutes. The whole query has 83.000 rows.

I tried the same statment under other engines (Postgresql for example) and it runs inmediatly.

Somebody why?. It seems it is very simple.

Best regards.