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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Question about indexed views
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

352 Posts

Posted - 12/05/2012 :  11:23:00  Show Profile  Reply with Quote
In Oracle you can specify an interval for materialized views to be refreshed. In SQL Server they get refreshed when a base table is updated. That means that you don't effectively get a performance gain if you create an indexed view containing a table that is updated often. For the reports in question I don't care if the data is a bit stale. So I'd like to instruct the indexed view to only update hourly. But that doesn't seem possible. It seems to really limit the usefulness of indexed views when compared to materialized view in Oracle. Am I wrong about this or is there a way to accomplish this in SQL Server?

Flowing Fount of Yak Knowledge

United Kingdom
3385 Posts

Posted - 12/05/2012 :  11:39:46  Show Profile  Visit nigelrivett's Homepage  Reply with Quote
The idea is that the indexed view has an index to access the data - it's not meant to allow viewing of historic data (which would probably mean using the transaction log).
Why not create a scheduled job that refreshes the data that you need periodically - or maybe just address the issue that causes the update to be a problem - maybe use a snapshot?

Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000