Subject Re: Query optimization - Query PLAN
Author lacakus
> > Thanks Dmitry for reply.
> > Backporting optimization from 2.5 to 2.1 would be a big work ?
>
> Yes, it would be highly undesirable.
>
I understand. Thanks.

Is there any smart workaround ?
My situation is as follows:
I have view, where are columns like:
coalesce(<subselect1>, 0) as col3,
coalesce(<subselect2>, 0) as col4,

and then in select these columns are used:

case when col3-col4<0 then 0 else col3-col4 end

Then in query plan I have 8 times:
PLAN (tablex (INDEX IX_tablex_...))

In ideal world I would expect 2 times ;-)

I did experiments with derived tables and CTEs but result (PLAN) is still same.