bala pramoth
bala pramoth

Reputation: 11

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.

Upvotes: 1

Views: 895

Answers (1)

user2225399
user2225399

Reputation: 69

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.

Upvotes: 1

Related Questions