如何跳过某些表上的视图登录到物化视图中以进行快速刷新

How skip view log on some tables into materialized view for doing fast refresh

有一个查询,其中一些 table 彼此连接在一起。由于性能和响应时间的原因,在其上创建了一个 fast refresh on commit 的物化视图,如下所示:

create materialized view mat_calc
refresh fast on commit
as
select po.title as post_title
       po.rowid as post_rowid
       c.title as comment_title,
       c.rowid as comment_rowid,
       p.title as person_title,
       p.rowid as person_rowidو
       cp.rowid as cp_rowid
  from post po, comment c, person p,post_comment_person cp
 where po.id = cp.post_id
   and c.id = cp.comment_id
   and p.id = cp.person_id  

如您所知,创建它的先决条件是 materialized view log 在每个 table 中进入此物化视图,如下所示:

create materialized view log on post;
create materialized view log on comment;
create materialized view log on person;
create materialized view log on post_comment_person;

如您所知,the materialized view log 是检测这些 table 的更改并将更改应用到物化视图。
我的问题是 post_comment_person table 只有 的变化影响了我的物化视图,因此没有必要在其他三个 table;另一方面,我希望只有 post_comment_person 可以刷新其他的,但这是不可能的,并引发以下错误:

ORA-23413: table "person" does not have a materialized view log.

怎么可能呢,因为personpostcommenttable的变化是没有关系的

更新

另外一方面我想提交我的MV的更改,包括人和评论的更改以及post插入和删除post_comment_人

的记录

我通过将 on commit 更改为 on demand 来快速刷新解决了刷新问题:

create materialized view mat_calc
refresh fast on commit

替换为:

create materialized view mat_calc
refresh fast on demand

所以在 post_comment_person 中插入后,我在自己的触发器中手动刷新实体化视图,如下所示:

DBMS_SNAPSHOT.REFRESH( 'mat_calc','f');