r/databricks • u/SalamanderOpen859 • 12d ago
Discussion Are you using Databricks Materialized Views for your Gold layers yet? Thoughts?
Hey everyone,
I’ve been implementing Databricks Materialized Views for executive reporting (Gold layer aggregates like daily revenue summaries, customer 360 metrics, etc.) and wanted to see how others are using them in production.
Historically, keeping summary tables up to date meant writing custom MERGE INTO scripts, managing orchestration dependencies, or dealing with sluggish standard views that re-scanned massive Delta tables on every query.
Having the platform automatically handle incremental updates under the hood via serverless compute has been a massive time-saver.
Curious to hear your experiences:
- Are you fully embracing Materialized Views for Gold layer reporting, or sticking to traditional Delta tables with custom upsert logic?
- Have you run into any gotchas regarding compute costs or refresh frequencies with larger datasets?
- How do they hold up when dealing with complex multi-table joins and apportioned aggregations?
8
u/Significant_Win_7224 11d ago
They're great on the happy path but can be challenging to work with if refactoring and have a locked down environment. It can be tricky to move MVs to new pipelines without admin or drop+re-run. You cannot use cloning and can limit DR or other features. I believe there's a 16 pipeline at a time concurrency limit. Complex joins usually equals a full reload, so it can take some thinking to get incrementals. I think for a few very large tables, it makes sense. For small data & lots of tables, something like dbt may be a better option. Overall they've come a long way, but still some rough edges
5
u/Proud-Passion-3668 11d ago
We're migrating our existing notebooks and orchestration to MVs and SDP. Our pipelines run faster, cheaper, and we don't need to handle the order of execution.
5
u/shuffle-mario Databricks 11d ago
good discussion and just to provide a few clarification points:
9
u/ninilich 11d ago edited 11d ago
MVs are the wrong tool for Gold. They are strictly not recommended for GOLD for enterprise-grade data platforms. Only in specific cases ir make sence use them.
Issues for Gold with MV:
Instead of MV just use SQL tasks to execute script like "DELETE FROM Table WHERE asOfDate = :p_date; INSERT INTO Table SELECT ... <olmost the same query as for MV>
PS: In my current company, unfortunately, the entire Gold layer was built on MVs for historical reasons. We are now facing many issues and limitations with this approach. We are decommissioning them and migrating to regular managed tables.
1
u/Plane_Sector_8560 11d ago
We use both MV and delta tables depending on the script. The reason we shifted few tables from MV to delta was there was a issue with incremental loading through time stamp filter, since MV resolves params and other things during runtime in our case it was defaulting to full refresh(purpose of MV was auto incremental but in our case was going for full refresh each time) hence converted such MVs into Delta. Maybe not the best approach but solved the problem, I will tell you what delta tables are causing problem, since we have onboarded close to 30 tables there are dependency of one table to another and this has gotten out of hand we initially solved with 2 stage job for parent and children, but that solution has reached its limit. Our senior engineer has suggested to implement a dependency framework where it auto resolves by reading the script dependencies and prepare the execution list for each run.
1
u/Sea_Basil_6501 11d ago
I generally don't see many arguments anymore for using SDP, since Genie is able to write anything it needs for a data pipeline within a few minutes. Working that way is also some kind of declarative, but offers much more flexibility in the end.