Search code examples
sqlviewazure-sql-databasematerialize

Azure SQL DW Materialized Views


I am trying to understand but its not obvious to me in the documentation of Azure SQL DW, if you materialize a view and any of the base tables of the view is being updated with data or data is deleted / truncated, will this affect what is accessible in the materialized view or will what was created in the materialized view at execution persist?


Solution

  • A Materialized View persists the data returned from the view definition query and automatically gets updated as data changes in the underlying tables.

    I tried All the operation you mentioned in Question on the base table of materialized view It is updating the view according to the changes perform on base table materialized view without restrictions.

    • Sample data enter image description here

    • Created Materialized view on table enter image description here

    • Updated data in base table and performed select operation on view enter image description here

    • Deleted data from base table and performed select operation on view enter image description here

    • Inserted data in base table and performed select operation on view enter image description here

    After every update on base table Materialized view is getting updated automatically.