Reputation: 24316
I am looking for the life cycle of an Oracle materialized view. For example the statement:
Create materialized view foo
Refresh On Commit
...
Will this view be updated every time there is a commit to my database, or just one of the tables referenced in the view statement? Also beyond this at what point does Oracle destroy the old cache and replace it with the new one? Specifically what is the window of "staleness" for a materialized view? Meaning is it dependent on how long it takes to create the materialized view.
Upvotes: 1
Views: 553
Reputation: 67722
The ON COMMIT
clause will modify the commit process of all transactions that issue DML on a base table:
Specify ON COMMIT to indicate that a fast refresh is to occur whenever the database commits a transaction that operates on a master table of the materialized view. This clause may increase the time taken to complete the commit, because the database performs the refresh operation as part of the commit process.
The commit will be dependent upon the success of the refresh of the materialized view (which means that a commit can fail because a dependent MV can't be refreshed).
The refresh takes place in the same transaction as the one that issues the commit. This means that as soon as the commit is complete, the changes are visible to all sessions (data is thus never stale).
Some of the things you have to be aware of:
Upvotes: 2