oracle – What happens when a request is made to a materialized view while it is being updated?

Question:

There is a mathematical representation

CREATE MATERIALIZED VIEW emp2 
REFRESH COMPLETE ON COMMIT 
AS SELECT * FROM emp;

Let's say someone made changes to the emp table, fixed (commit). The view starts updating, and then someone else makes a request to emp2. What will happen?

How to make sure that updated data is returned? How to do this at the expense of waiting for the changer and how to do this at the expense of waiting for the requester?

Answer:

Refresh essentially should not block access to an indexed view (materialized), i.e. essentially creating new physical records on the disk rather than overwriting it.

But if ALTER VIEW is done, then its exclusive lock occurs

Scroll to Top