benefit of cluster index on view in sql 2008 r2
-
hi to all i have a table that product ID is key and clustered . i create this view on my table if i not use of cluster index on view whats happen?
CREATE VIEW View3 WITH SCHEMABINDING AS
SELECT ProductID, SUM(UnitPrice*(1.00-UnitPriceDiscount)) AS Price,
COUNT_BIG(*) AS Count, SUM(OrderQty) AS Units
FROM Sales.SalesOrderDetail
GROUP BY ProductID
GO
CREATE UNIQUE CLUSTERED INDEX iv3 ON View3 (ProductID)note to this point that Product ID also Cluster index in base table thanks for any help
-
hi to all i have a table that product ID is key and clustered . i create this view on my table if i not use of cluster index on view whats happen?
CREATE VIEW View3 WITH SCHEMABINDING AS
SELECT ProductID, SUM(UnitPrice*(1.00-UnitPriceDiscount)) AS Price,
COUNT_BIG(*) AS Count, SUM(OrderQty) AS Units
FROM Sales.SalesOrderDetail
GROUP BY ProductID
GO
CREATE UNIQUE CLUSTERED INDEX iv3 ON View3 (ProductID)note to this point that Product ID also Cluster index in base table thanks for any help
Have a read of this http://blog.sqlauthority.com/2010/10/12/sql-server-indexed-view-always-use-index-on-index/[^] and this is a detailed article on how the clustered index works https://www.simple-talk.com/sql/learn-sql-server/effective-clustered-indexes/[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
-
Have a read of this http://blog.sqlauthority.com/2010/10/12/sql-server-indexed-view-always-use-index-on-index/[^] and this is a detailed article on how the clustered index works https://www.simple-talk.com/sql/learn-sql-server/effective-clustered-indexes/[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch