Tuesday 7 June 2016

Difference Between Views and Materialized Views





Ø  Materialized views are disk based and are updated periodically based upon the query definition.
Ø  Views are virtual only and run the query definition each time they are accessed.

Views                                                                                               Materialized View

1.           Views contain Up-to-date Data                                       1. Not so much up-to-date
2.           Slower Performance (due to Joins)                              2. Faster Performance
3.           Reparse each ‘SELECT’ Statement, always                 3. No need of Reparse, Fetches only                                                                                                                   previous data

When to Use View and Materialized View in SQL ?

Answer :
Mostly in application we use views because they are more feasible,  only logical representation of table data no extra space needed. We easily get replica of data and we can perform our operation on that data without affecting actual table data but when we see performance which is crucial for large application they use materialized view where Query Response time matters so Materialized views are used mostly with data ware housing or business intelligence application.

That’s all on difference between View and materialized View in database or SQL.
 I suggest always prepare this question in good detail and if you can get some hands on practice like creating Views, getting data from Views then try that as well.

Happy Learning .   :)

No comments:

Post a Comment