WL#2866: Materialized Views (reduced support)

Affects: Server-7.1   —   Status: Assigned

In September 2005, at a meeting in Chicago, there 
was sentiment for materialized views, Oracle-like, 
but without refreshing. This preliminary description 
is taken from an old worklog task, WL#941 "Views". 
 
Feature: Permanent Materialized Views  
-------------------------------------  
  
This feature goes by different names: AST or MQT in DB2, Indexed Views  
in SQL Server, and Materialized Views in Oracle (an older Oracle  
incarnation was "Snapshots"). The idea is: a view (usually a grouped  
view or join view) can be materialized permanently, so that  
queries of summary data will be quick. In other words, the "temporary  
table" that we produce with the temporary-table algorithm isn't a  
temporary table, it's a permanent table.  
  
It's hard to maintain the summary if anyone changes the base table.  
I am proposing: we would not "refresh" permanent materialized views      
frequently -- instead, we would allow them to become stale. When the               
server restarts, the permanent materialized views empty. When a      
permanent materialized view is queried for the first time, it is                
populated.      
               
The above proposal is unsophisticated. Our competitors allow periodic      
refresh, and can update the permanent materialized view by checking  
log entries. At one time I believed that there would be a standard,
but "CREATE MATERIALIZED VIEW" isn't in SQL:2008.
      
A comment from a major customer is: "Usually database server restarts
never or restarts once within x months. Therefore it is of no use to
wait for the next restart for refreshing the view. On the other hand:          
the first application preparing the view will not like      
to wait for its preparation." At a meeting with that customer,        
the decisions were:      
(a) this is not relevant for the main product, and not        
    needed in the data warehouse environment      
(b) "it is a permanent temporary table that is crontabbed",        
(c) "this is not really a view",      
(d) Permanent Materialized Views should be materialized      
   (persistent) forever,      
(e) There should be options for resynching, as part of the  
    VIEW definition.