Sub topic 3
Compute types and how each is billed
This chapter assumes you know the Databricks workspace (notebooks, clusters, jobs), can read basic SQL, and understand that cloud providers bill for instances and storage. The previous chapters covered DBUs and SKUs. Here you will see how each compute type turns running time into charges.
The common billing model
Most Databricks compute bills in two streams while it runs:
- Databricks charges: DBUs consumed per hour multiplied by the price of the SKU.
- Cloud charges: the virtual machines, disks, and networking that your cloud provider bills to your own cloud account.
Serverless compute differs. Databricks runs the infrastructure, so the cloud cost is folded into the DBU price and appears on one bill.
The compute type decides which SKU you pay for. The same node can cost very different amounts per DBU depending on how you use it.
The main compute types
| Compute type | Typical use | Billing SKU family | Cloud infrastructure bill |
|---|---|---|---|
| All-purpose compute | Interactive notebooks, exploration | All-purpose | Yours |
| Jobs compute | Scheduled or triggered pipelines | Jobs | Yours |
| SQL warehouse (classic or pro) | BI and SQL queries | SQL | Yours |
| Serverless (SQL, jobs, notebooks) | On-demand work with no cluster management | Serverless | Included in the DBU price |
All-purpose compute
All-purpose clusters are shared and long-lived, so they are designed for interactive work. They carry the highest DBU rate. They also tend to sit idle, because people leave notebooks attached. Idle time is billed the same as busy time until the cluster terminates.
Jobs compute
A job cluster starts when a job run begins and ends when the run finishes. It has a lower DBU rate than all-purpose compute. Running production pipelines on all-purpose clusters is a common and avoidable cost error.
SQL warehouses
A SQL warehouse is billed by its size and by how long it runs. Each size has a fixed DBU rate per hour, and a warehouse running with no queries still bills until auto-stop shuts it down. Pro and serverless warehouses cost more per DBU than classic ones, in exchange for more features or faster startup.
Serverless compute
Serverless starts in seconds and scales automatically. You are billed for the compute you use rather than for idle cluster time that you manage. The DBU rate is higher, because it includes the infrastructure. Later chapters cover when that trade is worth it.
How the bill grows
Cost scales with node count, node type, and running time. Autoscaling changes node count while a cluster runs, so DBU use varies over time.
Seeing compute type in the data
The system.billing.usage table records the SKU for each usage row, and the SKU name reveals the compute type. This query groups recent usage by SKU:
SELECT
sku_name,
SUM(usage_quantity) AS dbus
FROM system.billing.usage
WHERE usage_date >= date_sub(current_date(), 30)
AND usage_unit = 'DBU'
GROUP BY sku_name
ORDER BY dbus DESC;If an all-purpose SKU dominates the result, look for production work running on interactive clusters.
Common errors
- Comparing DBU rates alone. Serverless looks more expensive per DBU, but it has no separate cloud bill and less idle time. Compare total cost for the same work.
- Forgetting the cloud bill. System billing tables show DBUs and list-price estimates, not your cloud provider's instance charges.
- Leaving interactive clusters on. Without auto-termination, an all-purpose cluster bills overnight.
Exercise
A nightly ETL pipeline runs for 2 hours on an all-purpose cluster that your team also uses for notebooks. Which compute type should the pipeline use instead, and why does this lower the Databricks charge?
Show answer
Use jobs compute. A job cluster starts for the run and ends afterward, and its SKU has a lower DBU rate than all-purpose compute. The same DBU count therefore costs less, and the cluster no longer sits idle after the run.