我有一个视图,其中包含两个由select
加入的union
。当我执行select * from view_name
时,执行时间过长。
但是,当我执行此视图的内容(两个选择与联合)时,它输出结果太快。
它有什么问题?
Create or replace view view_name as
select * from (
select ... from table_1
join table_1 n on ..
join table_2 o on ..
join table_3 rr on ..
join table_4 t on ..
join table_5 cc on ..
where ...
union
select ... from table_6 sdpd
join table_7 sdp on ...
join table_8 sdo on ...
join table_9 nom on ...
join table_10 rr on .
join table_11 t on ...
join table_12 cc on ...
where ... group by ...
) order by 1,2