欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Oracle物化视图

程序员文章站 2022-10-31 23:07:48
Oracle物化视图。 1、创建物化视图: create materialized view MV_YHMYDBB PARALLEL 10 refresh force on...

Oracle物化视图。

1、创建物化视图:

create materialized view MV_YHMYDBB PARALLEL 10

refresh force on demand

start with sysdate next trunc(sysdate) + 1 + 5/1440

as

select ……

2、手动刷新物化视图:

alter materialized view MV_YHMYDBB refresh force;

3、修改物化视图下次刷新时间:

alter materialized view MV_XZQYSCTJ

refresh force on demand

next null

4、实表更新:

truncate table mv_sv_dispatch;

insert /*+append*/ into mv_sv_dispatch

select /*+parallel(sd 10)*/ SD.REQUEST_ID,

inform_org_id,

MIN(SD.Dispatch_Date) Dispatch_Date

from SV_DISPATCH SD

WHERE SD.DELETED_FLAG = '0'

and SD.Inform_Org_Type = 'SS'

GROUP BY SD.REQUEST_ID, sd.inform_org_id;

commit;

5、建物化视图索引:

create index idx_MV_XZQYSCTJ_1 on MV_XZQYSCTJ(RECEIPT_DATE)