Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Indexed Views

Author  Topic 

ddamico
Yak Posting Veteran

76 Posts

Posted - 2011-09-08 : 20:43:52
Good day all,

I have a few questions regarding indexed view I am hoping someone can debunk or confirm.

I was under the impression that in order to maintain a indexed view on a table that changes that you need to drop/create the clustered index in order to for it to be up-to-date.

I was reading some post however, that lead me to believe that the index of the view is maintained during deletes and updates (not sure about inserts). They were saying the only reason for dropping the index is so that update/deletes to the final table would have less contentions having to maintain the clustered index on the view.

Can someone definitively tell me if the above statement about an index view maintaining the index is true? If it is true then if the table is only having inserts done on it?

I would think if you have a view defined like the following it would
not be a true statement. Thanks!


CREATE VIEW abc
SELECT Id, Val1, Val2
FROM table_a
WHERE Val2 = 10

CREATE UNIQUE CLUSTERED INDEX IXV ON abc(Id)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-09-08 : 21:26:05
All indexes are up-to-date.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -