To create a materialized
view, use the following SQL pass-through syntax.
EXECUTE (Create Materialized View <viewname> as Select ) BY [sasspds | alias];
All other references
to the view follow the existing SQL syntax, whether it is a standard
SQL view or a materialized view. The Materialized keyword is used
only in the Create statement. For example, to drop a materialized
view, you would use the following syntax.
EXECUTE (Drop View <viewname> ) BY [sasspds | alias];
If any of the input
tables to a materialized view are modified, the next time the view
is referenced, a refresh is performed on the materialized view table.
You can use an
spdsserv.parm file option
setting to specify the time delay before the materialized view table
is refreshed.
MVREFRESHTIME=<number-of-seconds> ;
Where <number-of-seconds>
specifies the number of seconds before the refresh starts. You can
set the MVREFRESHTIME= option to any integer value between 0 and 86400.
The default MVREFRESHTIME= specification is 30 seconds.
The reason that a time
delay might be necessary before refreshing a materialized view table
is to prevent processor thrashing. Processor thrashing might occur
if you refresh the materialized view table when other processes are
concurrently processing updates to the tables that are used in the
view. If your computing environment does not perform multiple concurrent
table updates, then you can set MVREFRESHTIME=0 and eliminate any
time delay associated with materialized view refreshes.