Code
Create materialized view [view_name]
Refresh [Fast | complete | force]
[
On [commit | demand] |
Start with (start_time) Next (next_time)
]
As
{Query statements for creating materialized views}
These are common syntaxes used to create a materialized view (materialized view) in Oracle. The meanings of parameters are as follows:
1. Refresh [Fast | complete | force] view refresh method:
Fast: Incremental refresh. assume that the previous refresh time is T1. When you use the fast mode to refresh the materialized view, only the data that has changed from T1 to the current time period is added to the view. to record this change, a materialized view log table is also required to create an incremental refresh materialized view. Create materialized view log on (primary table name ).
Complete: refresh all. It is equivalent to executing a query statement to create a view again.
Force: This is the default data refresh method. When the fast mode is available, data is refreshed in the fast mode; otherwise, the complete mode is used.
2. Mv data refresh time:
On Demand: refresh the data when the user needs to refresh. Here, the user is required to refresh the data manually (or use the job to refresh regularly)
On commit: when data is submitted in the master table, the data in the MV is refreshed immediately;
Start ...... : Refresh Every time (specified by next) from the specified time;