Nidhi Gupta
Analytics Vidhya
Published in
2 min readJun 10, 2021

--

MATERIALIZED VIEW vs VIEW in PostgreSQL

Difference between view and materialized view?

Tracking issue of materialized view

  1. The addition of the materialized views feature in Postgres represents a substantial benefit on read-queries performance if our application can tolerate stale(old)data.
  2. It helps to reduce disk access and complex query computations by flattening a View’s result set into a physical table.
  3. Auditing the creation, modification, and refresh operations for the materialized views can be time-consuming.

Postgres extension called mv_stats, which allows the DataOps to track and query this information in a more practical manner.

In our database execute:

CREATE EXTENSION mv_stats;

Note:- Previously created views will be automatically added to the stats on blank, and they’ll update on the next refresh

select * from mv_stats;

As a output, we will get…

--

--

Nidhi Gupta
Analytics Vidhya

Azure Data Engineer 👨‍💻.Heading towards cloud technologies expertise✌️.