Subject NO Optimizated VIEW with UNION inside
Author skander_sp
I have a problem with a view with a UNION ALL inside.

I used many times VIEWs, making easy some works with complex selects.

I check that a SELECT with WHERE on a VIEW is optimized (just like the
WHERE is inside the VIEW itself) making all fine and quick.

But I need to use a VIEW with a UNION ALL inside, and cheching I see
that NO OPTIMIZATION was improved here, and the SELECT with WHERE on
this VIEW was MUCH MUCH MUCH slow (just like the WHERE "filter" was
aplied LATTER to the UNION.

I think the WHERE condicion was applied to every SELECT on the UNION
to optimize, but not the same results on time (time checked, 1:20 or

There is an error? fail optimization? Some idea?