Skip to content

A scenario for a data engineer · Mid level and up

The nightly job no longer fits in the night

Chief · Your manager
Monday, 07:30

A Databricks job rewrites a two terabyte Delta table from scratch every night. About one percent of the rows change in a day. It now finishes after the morning reports start.

What do you do?

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

Show the best call

Load only what changed and MERGE it into the table.

The job handles one percent of the data and finishes in minutes.

Why

Rewriting everything costs the same however little changed. An incremental load reads only new or changed rows, and a MERGE applies them. Change data feed gives you the changed rows of a Delta table, and Auto Loader picks up only the files that are new.

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

The other two

Works, at a price. Move the job to a cluster twice the size.
It fits again, for twice the money, until the table grows some more.
A poor call. Start the job two hours earlier.
It now runs into the evening loads, and both are slow.

The words in this scenario

MERGE.
One statement that compares new rows with a table by a key: rows that match are updated or deleted, rows that do not are inserted. 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.