Archive

Archive for the ‘Create Indexed Views’ Category

How to Create Indexed Views

April 13, 2010 Leave a comment

An indexed view is a view that has been materialized. This means it has been computed and stored. You index a view by creating a unique clustered index on it. Indexed views dramatically improve the performance of some types of queries. Indexed views work best for queries that aggregate many rows. They are not well-suited for underlying data sets that are frequently updated

CREATE VIEW <View Name>
WITH SCHEMABINDING
AS
SELECT Col1,Col2,Col3
FROM dbo.tablename

create unique clustered index indexname on dbo.viewname (colnames)