Can we create index on views?
Answers were Sorted based on User's Feedback
Answer / madhoosapre
An index cannot be defined on a view. Because view is
virtual table, which consists of a subset of columns from
one more tables.
The Restrictions imposed on views are as follows:
1. A view can be created only in the current database.
2. A view can be created only if there is a SELECT
permission on its base table
3. A Trigger or an Index cannot be defined on a view.
4. A view cannot be derive its data from temporary tables.
5. The CREATE VIEW statement cannot be combined with other
SQL statements in a single batch.
Is This Answer Correct ? | 144 Yes | 67 No |
Answer / ashok naik
Yes that is called indexed views using this we can improve
Query performance if your view contain single select
stament then we can easily establish unique clusterd index
Is This Answer Correct ? | 63 Yes | 20 No |
Answer / md sajjad
No We cannot create index on view:
e.g
1* create view emp_view as select * from emp where
deptno=20
SQL> /
View created.
1* create index indx_emp on emp_view(empno)
SQL> /
create index indx_emp on emp_view(empno)
*
ERROR at line 1:
ORA-01702: a view is not appropriate here
Is This Answer Correct ? | 39 Yes | 16 No |
Answer / janaka
Yes we can create Indexed view.
use
CREATE UNIQUE CLUSTERED INDEX i_IndexA
ON View_Name(field1,field2)
Is This Answer Correct ? | 55 Yes | 35 No |
Answer / prakasam
yes. we can.
http://msdn.microsoft.com/en-us/library/aa258260
(v=sql.80).aspx - Refer the url
Is This Answer Correct ? | 5 Yes | 2 No |
Answer / karthik
clear short article about Indexed View
http://mssqltipsandtricks.blogspot.com/2012/01/index-on-views.html
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / itishree chhotray
View should be Schema binding,before creating index on view.
We can create Unique Clustered index on view after that we
can create non clustered index but we should have at least
one unique clustered index on view.
Is This Answer Correct ? | 0 Yes | 0 No |
What happens to the current transaction if the session is killed?
What is SQL access advisor in Oracle?
How to store pictures on to the database?
write sql query following source are EmpID, Salary 101 1000 102 2000 103 3000 I want the output format like following empid,sal,composite_sal 101 1000 1000 102 2000 3000 103 3000 6000
How to create a table index?
how to hide the stored procedure inside a package
What is the difference between count (*), count (expression), count (distinct expression)?
How to return top 5 rows in oracle?
can you write commit in triggers?
12 RULES OF RDBMS
How to get a list of all user accounts in the database?
What is set verify off in oracle?