SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

ferrethouse
Constraint Violating Yak Guru

327 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?

nigelrivett
Flowing Fount of Yak Knowledge

United Kingdom
3383 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  
 New 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.03 seconds. Powered By: Snitz Forums 2000