How to think about it
- Photon is a native vectorized engine for Spark SQL and DataFrame operations.
- On classic compute, enabling Photon increases the DBU rate.
- Saving = (run time without Photon × rate) − (run time with Photon × higher rate). Only real runs tell you.
Likely gains vs little gain
| Likely to gain | Little or no gain |
|---|---|
| Large scans, filters, aggregations, joins | Python UDFs and pandas code on the driver |
| MERGE, UPDATE, DELETE on Delta | RDD-based code |
| Writing Delta/Parquet | Small data where startup dominates |
| Wide tables, many columns | Jobs waiting on external systems (APIs, JDBC sources) |
Check Photon coverage
In the Spark UI SQL tab (or query profile), operators run by Photon are marked (e.g. Photon... nodes). If a big part of the plan falls back to non-Photon operators, gains will be limited.
Common fallbacks: unsupported UDFs, certain functions or data types. Rewriting a UDF with built-in functions often lets Photon run the whole stage (see the UDF optimization post).
Run an A/B test
- Pick a job with stable input size.
- Run 3 times without Photon, 3 times with (same cluster size).
- Compare DBUs and VM time per run.
SELECT usage_metadata.job_run_id,
product_features.is_photon,
SUM(usage_quantity) AS dbus
FROM system.billing.usage
WHERE usage_metadata.job_id = '<job_id>'
AND usage_date >= current_date() - 14
GROUP BY ALL
ORDER BY job_run_id DESC;
Also consider a smaller cluster with Photon: faster engines sometimes let you drop nodes.
Set policy by evidence
| Result | Action |
|---|---|
| Clearly cheaper per run | Enable in the job cluster definition |
| Faster but more expensive | Enable only if the deadline needs it |
| No real gain | Leave off |
Cluster policies can allow or require Photon per job category.
Tip
Re-test after Databricks Runtime upgrades. Photon coverage grows over time, so a job that didn't benefit last year might now.
Checklist
- Job's Photon coverage checked in Spark UI
- UDF fallbacks reviewed
- A/B cost per run measured
- Smaller cluster with Photon tried
- Decision recorded per job; re-tested after upgrades