Sunday , December 22 2024

PostgreSQL Refresh Materialized View

A “materialized view” is a database object which stores the result of a precalculated database query and makes it easy to refresh this result as needed.

After creating the materalized view, when data is added, removed and updated to the tables in the materalized view, the data in the materalized view does not change.

To update the changed data, it is necessary to update the materalized view with the “refresh materalized view” command.

Let’s do an example.

After adding our data, when we select the Materialized view called “actorfilm”, we see that the same number is returned and there is no change.

After running the refresh command, we see at the bottom right that our record has increased by one.

Loading

About Faruk Erdem

Leave a Reply

Your email address will not be published. Required fields are marked *