A scenario for a data engineer · Junior and up
The dashboard takes four minutes
Query · Analytics
Thursday, 11:00
A Delta table fed by a stream every minute now holds hundreds of thousands of tiny files. Databricks SQL queries on it crawl.
What do you do?
Tap the one you would do. The answer opens below.
Show the best callThe best call
Run OPTIMIZE to compact the files, and turn on auto compaction for the table.
Queries read a few large files, and the dashboard is back to seconds.
Why
Many small files make every read slow. OPTIMIZE rewrites them into larger ones, and optimized writes and auto compaction cut down how many new small files appear. On Unity Catalog managed tables, predictive optimization does this for you.
Read it in the Databricks docs (opens in a new tab)The other two
- Works, at a price. Give the SQL warehouse a larger size.
- Faster, at a higher bill every hour, and the files keep piling up.
- A poor call. Leave the table alone and cache the dashboard for a day.
- The dashboard is fast and a day old. Every other query on the table is as slow as before.
The words in this scenario
- OPTIMIZE.
- A command that rewrites the many small files of a Delta table into fewer, larger ones. On a table with liquid clustering it also groups the rows by the clustering columns. In the docs (opens in a new tab)
- SQL warehouse.
- Compute made for running SQL queries and dashboards. In the docs (opens in a new tab)
Go deeper on brickster.ai
- Delta Lake: what changed recentlyNews, releases, videos and questions on it, gathered daily.
- Drill Spark in PracticeShort questions with the reason after each answer.
More scenarios
- One task has been running for an hour · data engineer
- The cleaning step takes most of the run · data engineer
- The nightly job no longer fits in the night · data engineer
- All 47 scenarios
Had one like this at work? Send it to us: the best tickets come from real incidents.
Checked against the Databricks documentation on . brickster.ai is independent and is not affiliated with Databricks.