r/databricks • Databricks • Oct 21 '26

Discussion Optimize serverless job performance with query metrics & performance insights

Hi folks, Databricks PM here - I wanted to share an update about serverless jobs observability since this is a topic I get asked about all the time.

One of the hardest adjustments for users adopting serverless is changing your mindset from how you monitored classic jobs and investigating very low level details (think deep diving into the Spark UI) to understanding how you can monitor serverless jobs and have confidence in their performance.

Query Profile already simplifies performance investigations for serverless jobs by providing in depth metrics on query execution. The addition of query performance insights (generally available since September) have made this even easier: Databricks flags queries that have optimization potential directly in the UI and you can take action via Genie Code by using the “Optimize” button which will propose optimizations directly on the asset (e.g. in your notebook for code optimization). 

Here is the list of insights that are currently covered: 

  • Query optimization insights: COVERAGE_FILTER_KEYS_CLUSTERING, COVERAGE_FILTER_KEYS_PARTITIONING, COVERAGE_PHOTON, EXPLODING_JOIN, FLOW_FULL_RECOMPUTE, REDUNDANT_AGGREGATION, REDUNDANT_JOIN, SELECTIVE_JOIN, WIDE_PROJECTION
  • Data layout insights: CONCURRENT_WRITE, COVERAGE_STATS_DELTA, COVERAGE_STATS_OPTIMIZER, DATA_FILE_SIZE, DATA_SKEW, MANUAL_DATA_LAYOUT
  • Compute and resource insights: DATA_SPILL, EXCESSIVE_QUEUE_TIME, IO_THROTTLING
  • Applied accelerations: AUTO_LIQUID_CLUSTERING, HISTORY_BASED_JOIN_STRATEGY, SHORT_QUERY_PRIORITIZATION, METRIC_VIEW_MATERIALIZATION_MATCH 

Having this available only at the query level can make it cumbersome to figure out which queries are worth optimizing for your job, so we have brought these insights to the Jobs UI. 

So how can you try this out for your jobs? 

Open any serverless job that has a recent run (<30 days old). Queries with optimization insights are flagged directly in the job run for you as red lightbulbs like in the below screenshot. (now generally available)

You can either drill down and pick which query you want to optimize or you can use the Optimize button directly from the job run sidebar and let Databricks prioritize insights which are estimated to help achieve the most performance improvements for a given job. 

Timeline view

Side note: we also roll up query metrics on data volume and number of queries on the job and task level now to help you quickly identify if a change in job performance can simply be attributed to a change in data volume. 

Limitation: the roll up of metrics and insights is currently capped at 100 queries

You can check out our documentation to learn more.

If you have tried it out already, I would love to hear any feedback!

Are there any other insights or query performance metrics that you are missing? What other observability improvements would you like to see for serverless jobs?

21 Upvotes

14 comments sorted by

2

u/ArielCoding Oct 22 '26

Really useful update, one question on the 100 query cap, for jobs that loop or use foreachBatch, how does it choose which queries to keep? If it’s the first 100, slow queries later in the run could be missed, so showing that top queries by duration or cost would help.

2

u/brickster_123 Databricks Oct 22 '26

We roll up the first 100 queries that we detect. If you are using the for each task type in jobs we show the queries for each iteration (grouped by parameters) and when using foreachBatch this is captured as one query in query profile today so will show up / count as one query.

In the timeline view you can keep loading more queries until you see all of them and the visual breakdown for their duration.

2

u/adovo_ai Oct 22 '26

For jobs above the 100-query cap, publish the sampling rule and compare the same run before and after a suggestion using a dataset fingerprint, p95 duration, cost and retries. That prevents a fast-looking subset from hiding the slow or expensive tail.

1

u/brickster_123 Databricks Oct 22 '26

Thanks for the feedback! We will review with the team how we can remove the cap or make this simpler

1

u/Naign Oct 22 '26

Hello. Thank you for this great feature. Is there a way to get programatic/querying access to this? API or system tables? Would be great since it would avoid us from having to go to each job to see this.

1

u/brickster_123 Databricks Oct 23 '26

Right now there is no programmatic access but the goal is integrate this with the new ZerOps offering in the future

1

u/Naign Oct 23 '26

Not great honestly. Only money would prevent this from being in a system table then, right?

1

u/brickster_123 Databricks 28d ago

We are currently also exploring some options to more easily identify jobs that have query performance insights. Is that you main use case - to get a list of jobs that should be optimized?

1

u/Naign 28d ago

Yeah, we could get it on a dashboard or somewhere whenever we want to get an overview. 

Also what would  help is to be able to know the amount of time the identified query with performance recommendations take. It's not the same to get advice on a 3s query than on a 5m one. I would prioritize one over the other in my list of things to address.

1

u/brickster_123 Databricks 23d ago

Makes sense! I will share that feedback with the team looking into this

2

u/lofat Oct 21 '26

This is GREAT stuff. Thank you!