mv complate重新整理時使用DELETE OR TRUNCATE!

qqmengxue發表於2011-12-22

You Asked

I am seeing that when I use the dbms_mview.refresh function to refresh a group of Materialized Views, that the view contents are deleted. I have also seen that if I set atomic_refresh to False, that Truncate should be used. In reading the description of atomic_refresh indicates whether the group of MV's is refresh together or as independent refreshes. It does not discuss 'Delete' vs 'Truncate'.

My situation is that I have several MV's that are quite large and would prefer to refresh them using Truncate.

My question, If I provide a list of MV's to the dbms_mview.refresh function, what is the use of Truncate, based on the setting of atomic_refresh? Or, should I be doing something else to ensure that Truncate is used?
[@more@]

and we said...



we've talked about this a couple of times.


If you "have several MV's that are quite large and would prefer to refresh them using Truncate", in 10g and above you would use atomic_refresh=>FALSE

that permits us to user

truncate+insert/*+APPEND*/

to rebuild the MV (the MV disappears for a while, becomes empty - you have to expect that)

else, if atomic_refresh=>TRUE, we use

delete+insert

to rebuild the MV (the MV never disappears, transactional consistency is there)



If you use a list like mv1,mv2... - and atomic_refresh=>FALSE, it'll use truncate+insert/*+Append*/ on them in turn.

引自:http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1857127200346321681

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10130206/viewspace-1056922/,如需轉載,請註明出處,否則將追究法律責任。

相關文章