日期:2014-05-17  浏览次数:20859 次

oracle什么时候会自动创建视图?
今天测一个SQL,顺便看了下执行计划,发现执行过程中ORACLE自行创建了视图
a view definition was processed...

我就想问下什么情况下,ORACLE会自己建视图,是不是建视图后对查询效率有影响?


另外还有个问题,
SQL code

select a.tran_amt,a.tran_type,b.* (
select tran_type, sum(tran_amt)as tran_amt  from table  group by tran_type
) a join table b on a.tran_type =b.tran_type
where a.tran_type = 1234



比如上面这个句子,给a表查询出来的2个字段起了别名,并且a.tran_type在a表中建有索引,那么在最后写where 条件的时候,能否用上tran_type上的索引。

------解决方案--------------------
探讨

引用:

1 那是你自己在SQL里写的子查询

2 不一定


1.的确是子查询。但确实生成了临时视图。