Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Updatable views
Materialized views
6. Refreshing materialized views
Summary

Instruction

A materialized view doesn't keep track of changes in the underlying table automatically. However, we can manually update the data in a materialized view with the following instruction:

REFRESH MATERIALIZED VIEW top100_universities;

The query above will rerun the query in the materialized view and bring the data up to date.

Exercise

We again created the products table, inserted some data, and created the available_dairy_products view. We then added a new row to the table:

INSERT INTO product VALUES
(7, 'milk sandwich milk', 'dairy', 1.69, FALSE);

Your task is to refresh the materialized view.

We can now see the new row in the materialized view.

Stuck? Here's a hint!

Use:

REFRESH MATERIALIZED VIEW ...;