Lakshya

Databricks & Snowflake · Chapter 5 of 16

Databricks in practice

Workspaces, clusters, jobs, Delta Live Tables and Unity Catalog — what each is and when it bites.

4 min read0 diagramsAll 16 chapters

Databricks is a workspace over Spark, plus a set of managed capabilities around it. Knowing what each piece is for prevents the most common mistake, which is using notebooks for everything.

Compute: the thing that costs you money

TypeWhat it isUse it for
All-purpose clusterInteractive, shared, stays upDevelopment and exploration. Expensive if left running — set auto-termination
Job clusterCreated for one job, destroyed afterEvery scheduled workload. Cheaper and isolated
SQL warehouseOptimised for BI-style SQL, serverless optionDashboards and analyst queries
ServerlessNo cluster to manage, starts in secondsRemoves idle cost and cold starts; less control

The single biggest cost mistake is running production jobs on all-purpose clusters and leaving them up. The second is oversizing: a bigger cluster does not help a job bounded by a shuffle or by skew, and you pay for the idle cores.

Delta Live Tables and the declarative model

DLT lets you declare tables and the transformations between them, and the platform works out dependencies, orchestration, retries and data-quality expectations. It removes a lot of orchestration code. The trade is less control and a proprietary layer — a reasonable choice when the pipeline is genuinely declarative, a poor one when you need custom behaviour.

Unity Catalog, which is the governance answer

  • Three-level namespace — catalog, schema, table — consistent across workspaces.
  • Central grants, including row filters and column masks, instead of per-workspace access control.
  • Lineage automatically, table and column level, which is worth more than it sounds when an incident happens.
  • It is where the governance story lives, so ‘how do you control access?’ on Databricks is a Unity Catalog answer.

What people get wrong

Notebooks as production. Notebooks are for exploration. Production belongs in version-controlled code with tests, run as jobs. A pipeline that only runs when someone opens a notebook is not a pipeline.

collect() on a large DataFrame. Pulls everything to the driver and kills it. The driver is a single machine.

Ignoring skew until it is a production incident. Check the Spark UI for one task far outlasting its stage — that is the signature, and salting or a broadcast join is usually the fix.

Leaving auto-termination off. The most common line item on a surprising bill.

The pieces, and where each one bites

PieceWhat it isWhere it bites
WorkspaceThe collaborative surface — notebooks, jobs, reposNotebooks make production code easy to write and hard to review. Anything scheduled should live in a repo, not a notebook someone can edit while it runs
All-purpose clusterInteractive compute you attach a notebook toLeft running. This is the single largest avoidable cost on the platform. Set aggressive auto-termination and mean it
Job clusterCreated for a run, destroyed afterCheaper per unit and adds startup latency. For short frequent jobs that latency can dominate — which is what pools exist for
Declarative pipelinesDeclare tables and dependencies; the platform manages the flowGenuinely good for straightforward ingest-and-transform. Awkward the moment you need control the abstraction does not expose, and you cannot partially opt out
The catalogThree-level namespace, permissions, lineage, credential vendingThe real reason to be on the platform. Migration onto it is a project, not a setting
The vectorised engineA native execution engine under the same APISilent fallback on an unsupported function — you keep paying the faster meter for the slower engine, and nothing errors

The two cost mistakes that account for most surprise bills.

A cluster sized for the peak, running at the average. Somebody sized it for the worst hour of the month and it runs that way permanently. Autoscaling helps and does not fix the floor — the minimum worker count is the number that actually costs you.

An interactive cluster nobody terminated. An analyst attached a notebook on Friday afternoon and the cluster idled through the weekend. Auto-termination is the whole fix and it is routinely set to a value long enough to be useless.

The diagnostic: plot cluster uptime against actual job runtime. The gap is the bill you are paying for nothing, and it is usually far larger than anyone expects.

And the tuning order that works: check for skew first — uneven task durations within a stage — then file sizes, then partition pruning, and only then cluster shape. Resizing to fix skew adds workers that have nothing to do, which is the most common way a performance problem becomes a cost problem as well.

Check yourself

Where should scheduled code live?In a repo, not a notebook. Notebooks make production code easy to write and hard to review, and someone can edit one while it runs.
What is the largest avoidable cost?An interactive cluster left running. Auto-termination is the fix and it is usually set too long to help.
What is the diagnostic for wasted compute?Cluster uptime plotted against actual job runtime. The gap is what you are paying for nothing.
What order should you tune in?Skew, then file sizes, then partition pruning, then cluster shape. Resizing to fix skew just adds idle workers.
← How a query actually executesSnowflake in practice →