Subject Views with Unions
Author Ian A. Newby
Hi Folks,
Does anyone know whether views with unions are usable now?

I had a view which unioned three tables together for a particular
task,

CREATE VIEW FULLMENU(CODE,PARENT,DESCRIPTION,LINK, ORDERING)
AS
select menu_id,parent_id,description,
cast(null as varchar(150)), ordering
from mainmenu
union all
select
m.stream_id, m.parent, s.name ,
cast('/knowledge/'
|| s.stream_id as varchar(150)), m.ordering
from streammenu m join knowledgestreams s
on s.stream_id = m.stream_id
union all
select tool_id, parent_id,description,
cast(link as varchar(150)), ordering
from systemtools;

If I used this view anywhere else like
select * from fullmenu where code = '27' the view is executed
without using any indexes, ie plan natural. Even though each source
code field has an index.

This makes unions in views almost impossible to use due to them
relying on the plan of the view.

Regards
Ian Newby