postgresql

Difference between view (Temporary view & Permanent view) and Materialized view

View is the table(temporary or permanent) which contains SQL query and it returns result set. It is of two types
1) Temporary View is used in the SELECT statement.This is temporary and it is not stored in disk . For eg.

As comparison to normal query temporary view is fast. It generally used to optimized the query.

2) Permanent View is used to store SQL query and it returns result set.It is treated as normal table which contains columns and data. For eg.

Different operations:

If you update row in existing table then the updated data will not update in the view that you have created. You have to manually update value in the view with simple update query.
To drop view use :

Materialized View contains the whole data (columns and values) which is returned by SQL result set.It’s size is more in the memory because it contains the whole data(not result set). For eg:

If you update row in existing table then the updated data will not update in the view. You have to manually call

To drop materialized use :

 

Please follow and like us:

Post Author: Ambrish Rajput

1 thought on “Difference between view (Temporary view & Permanent view) and Materialized view

    Annonymous

    (January 13, 2018 - 3:53 am)

    Nice tutorial.

Leave a Reply

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