Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1134323
  • 博文数量: 276
  • 博客积分: 10077
  • 博客等级: 上将
  • 技术积分: 2513
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-24 20:31
文章分类

全部博文(276)

文章存档

2020年(1)

2015年(5)

2012年(2)

2011年(6)

2010年(7)

2009年(224)

2008年(31)

我的朋友

分类: Oracle

2009-07-23 16:22:57

How to speed up the MV refresh

1)PARALLELISM
Parallel execution enables multiple processes to work simultaneously to refresh the materialized view, resulting in speeding up the refresh process. Before you enable parallel execution in your database, you should ensure that you have enough resources (CPU and Memory) to run multiple processes in parallel. Setting the parameter PARALLEL_MAX_SERVERS to a value greater than 0 enables parallel
execution.
 
EXECUTE DBMS_MVIEW.REFRESH(LIST=>'MV_PART_SALES',PARALLELISM=>4);
 
 
2)ATOMIC_REFRESH
Parameter:ATOMIC_REFRESH influenced DBMS_MVIEW.REFRESH refresh.
ATOMIC_REFRESH parameter for materialized view refresh is meant to control whether each materialized
view in a list is refreshed in its own transaction, or whether all materialized views are refreshed
together in one transaction to a single point in time.

In 10g and above, if ATOMIC_REFRESH is set to TRUE (the default):
+If a single materialized view is being refreshed, a row-by-row delete will be done prior to inserting
rows back into the materialized view. This makes the refresh slower, but also maintains a principle of
atomicity that implies that the materialized view should allow read-consistent queries against it
during the refresh for the refresh to be atomic. This is why the change in behavior of the
ATOMIC_REFRESH parameter was done.
+If a group of materialized views are being complete refreshed, each materialized view in the group
will be deleted from row-by-row prior to inserting the data back in. In addition, all materialized
views are refreshed together in the same transaction; either all refreshes succeed, or if one fails
all of the refreshes will be rolled back. This is the same behavior as in 9.2.

In 10g and above, if ATOMIC_REFRESH is set to FALSE, the behavior is the same as in 9.2, i.e:
+If a single materialized view is being complete refreshed, the materialized view will be truncated.
+If a group of materialized views are being complete refreshed, each one will be truncated and
refreshed individually in a separate transaction. The number of job queue processes must be set to 1
or greater if this parameter is false.

EXECUTE DBMS_MVIEW.REFRESH(LIST=>'MV_PART_SALES',METHOD=>'C',atomic_refresh =>false);
阅读(1103) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~