The materialized view aims to save some queries that take a long time to obtain results in advance, save the results of these queries to a local copy, and then query the results later, you can query data from the materialized view without querying some remote data tables. This improves the query performance.
Create materialized view AUTHOR_MV
REFRESH FAST
START WITH SYSDATE
Next sysdate more than 5/86400
WITH PRIMARY KEY
AS
SELECT *
From author @ TO_DMED;
The above is an example of creating a materialized view.
Refresh fast indicates to REFRESH the materialized view in incremental REFRESH mode, but only when the LOG of the materialized view is created on the table, the incremental REFRESH is to REFRESH the data changed since the last time.
Other options include: Completely refresh COMPLETE, FORCE automatically select the above two methods, first select FAST if the conditions are met.
Start with indicates the time when the data is copied to the local device for the first time, and NEXT indicates the NEXT refresh time.
With primary key is used to create a materialized view of the primary key on a remote database table.
Create materialized view log on author
With primary key;
If refresh fast is used, the materialized view log of the original table must be created in the data of the original table.