cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Materialized Views Incremental Load

Dharinip
New Contributor III

My question is: can materialized views be updated incrementally. For example:

In my case, we store the data in Iron layer and it gets flattened in bronze and silver layer as separate tables. The required transformations happen from silver to gold layer.

All the Iron, bronze and silver layers are streaming tables as SCD type 2 and gets incrementally loaded. 

The Gold layer are materialized views. Every time the pipeline runs, the materialized views are fully refreshed. But we wanted to have those incrementally loaded.
Example:

SILVER        
         
Table: Client        
         
ClientIDClientNameAddressStatusCreatedDateStartDateEnddateRunDate 
1ABCFloridaNew03.15.202503.15.202503.16.202503.15.2025 
1ABCMiamiNew03.16.202503.16.202503.17.202503.16.2025 
1ABCMiamiActive03.17.202503.17.2025NULL03.17.2025 
2QWEKansasActive03.15.202503.15.202503.18.202503.15.2025 
2QWEKansasInactive03.18.202503.18.2025NULL03.18.2025 
3GHJBuffaloActive03.18.202503.18.2025NULL03.18.2025 
         
         
GOLD        
         
Materialized  View: Client       
         
IDNAMEAddressStatusCreatedDateStartDateEnddateRunDate 
1ABCMiamiActive03.17.202503.17.2025NULL03.17.2025These should also be incrementally loaded.
2QWEKansasInactive03.18.202503.18.2025NULL03.18.2025
3GHJBuffaloActive03.18.202503.18.2025NULL03.18.2025
1 REPLY 1

Brahmareddy
Honored Contributor II

Hi Dharinip,

How are you doing today?, As per my understanding, Right now, Materialized Views in Databricks always do a full refresh, so they can’t be updated incrementally like your streaming tables. Since your Iron, Bronze, and Silver layers are already handling changes incrementally with SCD Type 2, the best way to optimize your Gold layer is to replace the Materialized View with a Delta table that updates incrementally. Instead of refreshing everything, you can use a MERGE INTO statement to update only the new or changed records from the Silver layer. This way, your Gold table will always stay up to date without the heavy full refresh. Materialized Views are great for static or pre-aggregated data, but for your case, an incremental Delta table will work much better. Let me know if you need help setting it up!

Regards,

Brahma

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group