Skip to content

A scenario for a data engineer · Mid level and up

Storage tripled, and a quick fix

Patch · Your teammate
Wednesday, 16:10

Storage for a large Delta table on Databricks has tripled since it began to be rewritten daily. A colleague wants a nightly VACUUM that keeps zero hours. The team uses time travel to debug the last few days.

What do you do?

Tap the one you would do. The answer opens below.

Show the best call

Run VACUUM on a schedule with the default seven day retention.

The old files go once they are a week old. Storage falls, and last week can still be queried.

Why

VACUUM removes data files a table no longer references once they are older than the retention threshold, seven days by default. After it runs, versions older than that cannot be queried. Retention is the trade between storage and how far back you can go. On Unity Catalog managed tables predictive optimization runs VACUUM for you.

Read it in the Databricks docs (opens in a new tab)

The other two

Works, at a price. Run VACUUM by hand when the storage bill looks high.
It works each time someone remembers. Between runs the old files pile up again.
A poor call. Run the nightly VACUUM with zero hours of retention.
Storage is small. The first time a load goes wrong there is no earlier version to look at or restore.

The words in this scenario

VACUUM.
A command that deletes the data files a Delta table no longer uses, once they are older than the retention period. In the docs (opens in a new tab)
RESTORE and table history.
A Delta table keeps a history of its versions. A query can read an earlier version, and RESTORE puts the table back to one. 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.

Added on . Checked against the Databricks documentation on . brickster.ai is independent and is not affiliated with Databricks.