Oracle-使用DBMS_MVIEW.REFRESH刷新“按需刷新力"视图时会发生什么 [英] Oracle - What happens when refreshing a 'REFRESH FORCE ON DEMAND' view with DBMS_MVIEW.REFRESH

查看:1443
本文介绍了Oracle-使用DBMS_MVIEW.REFRESH刷新“按需刷新力"视图时会发生什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下具体化视图-

CREATE MATERIALIZED VIEW TESTRESULT 
ON PREBUILT TABLE WITH REDUCED PRECISION
REFRESH FORCE ON DEMAND
WITH PRIMARY KEY
AS 
SELECT...
FROM...
WHERE...

此实例化视图没有支持的材料视图视图日志".如上节所述,该MV具有按需"指定,并且根据Oracle文档,

This materialized view has no backing MATERIALIZED VIEW LOG. As seen in the clause above this MV has "ON DEMAND" specifies, and according to Oracle documentation,

"[按需]表示已实现 视图将按需刷新 调用三个DBMS_MVIEW之一 刷新过程."

"[ON DEMAND] indicate[s] that the materialized view will be refreshed on demand by calling one of the three DBMS_MVIEW refresh procedures."

当我调用DBMS_MVIEW.REFRESH('TESTRESULT')时,发生了什么事?是否手动检查每条记录以查看其是否已更新?

When I call DBMS_MVIEW.REFRESH('TESTRESULT') , what is occuring? Is it manually checking each record to see if it has been updated?

Oracle版本:10g

Oracle Version: 10g

推荐答案

默认情况下(此默认值在Oracle的不同版本中进行了更改),它将在物化视图上进行完整的原子刷新.这意味着将删除实例化视图中的数据,将重新执行基础查询,并将结果加载到实例化视图中.您可以通过将ATOMIC_REFRESH参数的值设为FALSE(即

By default (and this default changes in different versions of Oracle), that will do a full, atomic refresh on the materialized view. That means that the data in the materialized view will be deleted, the underlying query will be re-executed, and the results will be loaded into the materialized view. You can make the refresh more efficient by passing in a value of FALSE for the ATOMIC_REFRESH parameter, i.e.

dbms_mview.refresh( 'TESTRESULT', atomic_refresh => false );

这将导致实例化视图被截断,重新执行查询,并通过直接路径插入将结果插入到实例化视图中.这将比原子刷新更为有效,但是物化视图在刷新期间将为空.

That will cause the materialized view to be truncated, the query re-executed, and the results inserted into the materialized view via a direct path insert. That will be more efficient than an atomic refresh but the materialized view will be empty during the refresh.

这篇关于Oracle-使用DBMS_MVIEW.REFRESH刷新“按需刷新力"视图时会发生什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆