Thanks Dmitry for reply. Backporting optimization from 2.5 to 2.1 would be a big work ? L.
> > > > I guess, that it is because COALESCE is internaly transformed into CASE > > WHEN <subselect> IS NULL then 0 else <subselect> end > > So in expression is subselect twice. > > Correct. > > > My question is if <subselect> is really executed twice for every row in > > table1? or is there internal optimization where duplicate expressions > > are reduced? > > Optimization happens only in Firebird 2.5 and above: > http://tracker.firebirdsql.org/browse/CORE-501 > > > Dmitry >
