index on view

来源:互联网 发布:淘宝卖游戏号靠谱吗 编辑:程序博客网 时间:2024/06/08 12:25

It is not possible in a view but Index can be created on Materialized View.

You should understand that view is nothing but a mask on a table with certain restriction, which will have pointers to the actual data. Views do not occupy any space. So, obviously you cannot create an index on a view.

A view is really just a stored SQL statement so if you want to create an index on a view, create the index on the base table instead. Here is an example from the scott schema.


create or replace view emp_dept as
 select e.empno, e.ename, deptno, d.dname
 from emp e join dept d using (deptno);