简体   繁体   中英

Using Materialized View in a Query and Updating Base Table

I am new to oracle and kindly help to answer my question.

I have a materialized view "A_MV" created for a table "A". I have a procedure which will do a SELECT query from the materialzied view "A_MV" and then UPDATE the base table "A" on certain conditions on base table "A".

The SELECT query from "A_MV" is fast, but update to base table is too slow.

Kindly advice.

Thanks.

if mview is set to update on commit then this would force a rebuild of mview every commit. Also if materialized view log is defined then this can update much more often which would slow it down.

oracle's merge statement is a built in function that is very fast. Suggest in that case to make sure refresh on mview is set to refresh on demand prior to the merge. Note you can change it back afterward if you want without rebuilding the mview.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM