GotoDBA Did You Know Did You Know #6 – MViews

Did You Know #6 – MViews

When using materialized views, refresh is an important method we use. We can perform a full or fast refresh, depending on the materialized view properties and the existance of a materialized view log.

One thing that is important to know about refresh is that it is a transactional process. This means that all of the refreshed materialize views will be refreshed in a single transaction, and it will happen without any user interferance.
When performing a complete refresh, Oracle will use the “delete” command to remove all data from the materialized views and then will refresh them. After the refresh is completed, Oracle will commit and allow everyone to see the refreshed data. This is the default.
In some cases, we prefer Oracle to use “truncate” to empty the materialized views. It might interfere queries and every materialized view will be refreshed individually, but it is much faster with less redo generation.
This can be done by specifying the “atomic_refresh” parameter in “dbms_mview.refresh” to false.
Example:

exec dbms_mview.refresh('MY_MVIEW', 'C', atomic_refresh=> false).

Hope you find this helpful,
Liron

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post