今天测一个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_typewhere a.tran_type = 1234
比如上面这个句子,给a表查询出来的2个字段起了别名,并且a.tran_type在a表中建有索引,那么在最后写where 条件的时候,能否用上tran_type上的索引。
------解决方案--------------------