在有大量的数据中有部分数据有变化时,采用Fast Refresh方式进行Materialized View Refresh比Complete Refresh方式更高效。因为Complete Refresh 是先truncate materializde view表,然后,将Base表中的所有的记录copy到materializde view表中。而当使用fast refresh这种增量refresh的方式时,需要先建立一个Base表的log表,来记录最近一次materialized view refresh后的base表的所有变更,当fast refresh开始执行时,materialized view表将根据这个log表中的记录(记录了base表中变化过的记录的primary key,以及变更方式,更新,增加或者删除),对materialized view表作相应的更新。

解决方案 »

  1.   

    同意Yorckzhou。
    但是最好升级pack到9.2.7,否则有问题。
    如果米很多,建议用advanced replication将会得到更好的性能。
      

  2.   

    YorckZhou说得不错
    不过具体还是要看,每天的数据变更量有多少
    如果有一半数据要更新的话
    用Fast方式反而会得不偿失
      

  3.   

    【转载】
    Materialized views can be refreshed using COMPLETE, FAST, FORCE, ON DEMAND or ON COMMIT depending on the complexity of the materialized view. A COMPLETE truncates the materialized view table and reloads it from scratch. A FAST uses a materialized view log to only update changed rows. If you intend to use the FAST refresh method, you must create the materialized view log first and then the materialized view. A FORCE will perform a FAST if possible and a COMPLETE if required. ON DEMAND uses the DBMS_MVIEW or DBMS_SNAP packages to complete a refresh and ON COMMIT refreshes a materialized view or snapshot whenever a commit is executed against the base table (for a simple materialized view with no joins or aggregations.)
    Oracle8i provides a procedure, DBMS_SNAPSHOT.REFRESH_ALL_MVIEWS which handles refresh activity on materialized views on demand.