我们有一张 table TB_1
它具有按月和周列划分的月度和周数据。我们也有物化 View MV_1
继承自表TB_1
.
我们希望每周或每月刷新实体化 View 。
不确定我们如何从物化日志中捕获的所有更改中过滤出每周或每月的更改以进行部分刷新。
现在我们正在考虑在 TB_1
中有一个标志列.通过清除物化日志和更新标志,我们认为我们可以实现这一点。
有没有比根据特定标准进行部分刷新的过程更有效的方法?
最佳答案
我们这里有一个类似的案例:我们找到的解决方案是 partition the materialized view逐月(使用 PCT )。如果您在许可中将此作为一个选项,这可能是一个解决方案。然后您必须对“详细信息表”进行分区,TB_1
,可能还有 MV_1
的“详细信息表” .
execute dbms_mview.refresh(
list => 'your_partitioned_mview'
, method => 'P' -- this is where PCT is specified
, atomic_refresh => false
);
Is it possible to partially refresh a materialized view in Oracle?上还有其他解决方案.
编辑:
我会说使用“待刷新”标志进行快速刷新的解决方案值得尝试。不确定您是否需要事先清除 Mview 日志。只需更改要更新的记录的标志值即可。这是一个 nice howto我发现。
如果您有 Oracle 12.2, they introduced real-time Mviews ,这可能是您正在寻找的...
Oracle 12.2 introduced the concept of real-time materialized views, which allow a statement-level wind-forward of a stale materialised view, making the data appear fresh to the statement. This wind-forward is based on changes computed using materialized view logs, similar to a conventional fast refresh, but the operation only affect the current statement. The changes are not persisted in the materialized view, so a conventional refresh is still required at some point.
@use416,请让我们发布实际适用于您的案例的信息。
关于oracle - 物化 View 的部分刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51654064/