A scenario for a data engineer · Mid level and up
Twenty dashboards, one heavy query
Query · Analytics
Friday, 09:30
Twenty dashboards on Databricks SQL each run the same heavy aggregation over the orders table, all day. New orders arrive all day, so no cached result lasts. The SQL warehouse is busy, and every dashboard takes a minute to open.
What do you do?
Tap the one you would do. The answer opens below.
Show the best callThe best call
Create a materialized view of the aggregation, refreshed on a schedule, and point the dashboards at it.
The heavy work is done once per refresh, not once per dashboard. The dashboards read a small stored result.
Why
A materialized view stores the result of a query and updates it as its source tables change, on a schedule or automatically. Dashboards read the stored result, so the heavy work is not repeated for each of them. In many cases a refresh computes only what changed.
Read it in the Databricks docs (opens in a new tab)The other two
- Works, at a price. Write a nightly job that rebuilds an aggregate table, and point the dashboards at that.
- The dashboards are fast. You now own a job and a table, the numbers are up to a day old, and the whole aggregate is rebuilt every night.
- A poor call. Move the dashboards to a larger SQL warehouse.
- Each query is somewhat faster, at a higher price, and the same work is still repeated for every dashboard.
The words in this scenario
- SQL warehouse.
- Compute made for running SQL queries and dashboards. In the docs (opens in a new tab)
Go deeper on brickster.ai
- Databricks SQL: what changed recentlyNews, releases, videos and questions on it, gathered daily.
- Drill Spark in PracticeShort questions with the reason after each answer.
More scenarios
- The MERGE takes two hours · data engineer
- The dashboard takes four minutes · data engineer
- One task has been running for an hour · data engineer
- All 47 scenarios
Had one like this at work? Send it to us: the best tickets come from real incidents.
Added on . Checked against the Databricks documentation on . brickster.ai is independent and is not affiliated with Databricks.