In: Computer Science
Views are virtual in the database but Materialized view are persistent. Discuss the need to have materialized view instead of views and in what condition No materialization if preferred.
I need a unique answer and without handwriting, please.
ANSWER:
1) Why Materialized views are persistant?
Views are nothing but the Logical Virtual Tables created by "Select query", but the results are not stored anywhere in the disc. Every time we need the data, we need to fire the query so that we get the updated or latest data from original tables.
Materialized view are also the logical view of the data driven by "Select query" but the result gets stored in the disc along with the defination of the query.
When we create a view using any table, rowid of view is same as the original table but in case of materialized view rowid is different.
We can get the updated or latest data with the help of view ,but in materialized view we need to refresh again and again in order to get the latest data. Therefore, we need an extra trigger or some automatic method to keep the materialized view updated.
2) Case where no materialization is needed-
Mostly we use views because they are most feasible for an application where no extra space is needed, only logical representation of the data is required. Therefore, no materialization is needed in the cases where there is a problem of extra space.
Materialized views are mostly used in thee cases of data warehousing or business intelligence where Query Response Time Matters.
If you are satisfied by my answer please give a thumbs up. Thank You.