Skip to content

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 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

More 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.