Key takeaways
- Check first whether the time went into compute setup or into execution.
- Skew: a few tasks do most of the work. AQE splits skewed partitions only in sort-merge and shuffle-hash joins.
- Shuffle: filter rows and columns before joins, and check shuffle read/write and spill before changing partition settings.
- Data skipping: liquid clustering is the recommended layout for new tables and replaces partitioning and ZORDER.
- Increase compute only after the execution evidence shows that compute capacity is the constraint.
Why is your Databricks job slow?
A slow Databricks job is often caused by one of three problems: data skew, excessive shuffle, or poor data skipping. Each has a different remedy. Scaling up first can increase cost without removing the bottleneck: one oversized task can still hold up a stage, a shuffle still moves data, and a scan still reads unnecessary files.
The fastest route to a fix is to identify where time is spent, then apply the optimization that addresses that cause. Databricks provides useful automation, especially adaptive query execution (AQE), liquid clustering and predictive optimization, but each has limits.
Scaling up first can increase cost without removing the bottleneck.
Start with the evidence: How to diagnose a slow Databricks job
First check whether the time went into compute setup or into execution. For each task run, system.lakeflow.job_task_run_timeline records setup_duration_seconds and execution_duration_seconds. Use it rather than job_run_timeline, whose duration columns are only populated for legacy single-task jobs. If execution time grew, inspect the slowest stage.
| Signal | Likely cause | What to inspect |
|---|---|---|
| One or a few tasks run much longer than the rest | Skew | Compare max task duration with the 75th percentile; inspect partition sizes and key distribution. |
| Large shuffle read/write or disk spill | Excessive shuffle / memory pressure | Stage metrics, join and aggregation plan, rows and bytes exchanged. |
| Many files or bytes read despite selective filters | Poor data skipping / file layout | Scan metrics, filter columns, file statistics and clustering layout. |

1. Data skew: a few tasks do most of the work
Skew occurs when a small number of keys hold a disproportionate share of the data. Those keys create oversized partitions, so a few tasks run far longer while other executors sit idle. Null, default or highly popular values are common causes.
How Databricks helps: AQE splits skewed partitions in sort-merge and shuffle-hash joins, but never in broadcast joins or full outer joins. It doesn’t apply to streaming queries, and it doesn’t touch skew in aggregations or window functions; those need a design change.
- Inspect the key distribution and identify dominant or null keys.
- Pre-aggregate when it reduces the rows entering a join; verify that the aggregation itself is not skewed.
- For skew outside joins, redesign the operation, for example with salting or a two-stage aggregation.
2. Excessive shuffle: too much data moves between stages
Joins, aggregations, distinct operations and sorts can redistribute data across executors. Large shuffle volumes increase network, disk and memory pressure; spill occurs when execution memory is insufficient and data is written to disk.
Databricks approach: AQE uses runtime statistics to coalesce small partitions after a shuffle, and switches a sort-merge join to a broadcast hash join when one side is under 30 MB (spark.databricks.adaptive.autoBroadcastJoinThreshold). Separately, setting spark.sql.shuffle.partitions to auto turns on auto-optimized shuffle, which sizes the initial partition count from the query plan and input size instead of the fixed default of 200.
- Filter rows and select only needed columns before joins.
- Pre-aggregate when it materially reduces join input; broadcast only when the plan and table size make it suitable.
- Check shuffle read/write, spill and the physical plan before changing partition settings.
3. Poor data skipping: reading files the query does not need
Delta data skipping uses per-file statistics (including minimum and maximum values) to skip files that cannot match a filter. It works best when the layout keeps similar values together, and Databricks’ answer to that layout problem has evolved:

Databricks approach: Liquid clustering is the recommended layout for all new tables, including streaming tables and materialized views. It is generally available from Databricks Runtime 15.4 LTS, takes up to four clustering keys, and replaces partitioning and ZORDER; a table can’t combine them. Choose keys from your most common filters. On tables under 10 TB, extra keys can slow down single-column filters.
CLUSTER BY AUTOlets Databricks choose keys from the table’s query history and change them when the savings outweigh the cost. It needs a Unity Catalog managed table, Databricks Runtime 15.4 LTS or above, and predictive optimization.- Plain
OPTIMIZEclusters incrementally. After enabling clustering or changing keys, runOPTIMIZE ... FULL(Databricks Runtime 16.0 and above) to recluster existing data; on large tables this can take hours. - Predictive optimization runs OPTIMIZE, VACUUM and ANALYZE automatically on Unity Catalog managed tables and is enabled by default. External tables still need a maintenance owner.
Putting it together: modernize the table layout
Example: a nightly query filters sales.orders by order_date and customer_id. The table is partitioned by date and Z-ordered by customer_id, but small files are accumulating and maintenance is taking longer.
-- 1. Replace partitioning with liquid clustering (Databricks Runtime 18.1+)
ALTER TABLE sales.orders
REPLACE PARTITIONED BY WITH CLUSTER BY (order_date, customer_id);
-- Alternative on a Unity Catalog managed table with predictive optimization:
-- ALTER TABLE sales.orders REPLACE PARTITIONED BY WITH CLUSTER BY AUTO;
-- 2. Recluster existing data once (Databricks Runtime 16.0+); this rewrites the table
OPTIMIZE sales.orders FULL;
-- 3. Drop ZORDER BY from the old OPTIMIZE job (not allowed on clustered tables)Before you change the job
- Did setup time or execution time grow?
- Does the longest stage show skew, heavy shuffle/spill, or excessive file reads?
- Are clustering keys aligned with common filters, or is CLUSTER BY AUTO suitable?
- Are dominant/null keys creating skew in joins, aggregations or windows?
- Is predictive optimization on for your Unity Catalog managed tables, and who owns maintenance for external tables?
Conclusion: Match the optimization to the bottleneck
Improving a slow Databricks job starts with understanding where time is spent. Skew, excessive shuffle, and unnecessary file reads call for different responses. Use execution evidence to choose the right optimization, and assess whether compute capacity is still a constraint after addressing query design and data layout.
iLink Digital’s Databricks services bring together data engineering, lakehouse architecture, performance tuning, and ongoing optimization to help enterprises improve how their data platforms operate. As a Databricks Silver Partner, iLink supports both implementation and the operational work required to maintain performance as workloads grow.
Investigating recurring slow jobs or rising compute costs?
Talk to iLink’s Databricks experts about your workload and optimization priorities.
Frequently asked questions
Why is my Databricks job slow?
A slow Databricks job is often caused by one of three problems: data skew, excessive shuffle, or poor data skipping. Check first whether the time went into compute setup or into execution, then inspect the slowest stage to see which one applies.
Does adaptive query execution (AQE) fix data skew?
Only in joins. AQE splits skewed partitions in sort-merge and shuffle-hash joins, but not in broadcast or full outer joins, not in streaming queries, and not in aggregations or window functions; those need a design change such as salting or a two-stage aggregation.
Should a new Delta table use liquid clustering or partitioning?
Liquid clustering is the recommended layout for all new tables. It is generally available from Databricks Runtime 15.4 LTS, takes up to four clustering keys and replaces partitioning and ZORDER; a table cannot combine them.







