SQL warehouses and the Photon engine

What a SQL warehouse actually is under the hood, why there are three types (Classic, Pro, Serverless), and how Photon's vectorized execution makes DBSQL fast enough to compete with dedicated data warehouses

The question #

Your wind utility’s 15 analysts need fast SQL access to governed Gold tables. You know they need a SQL warehouse, not a Spark cluster. But what actually is a SQL warehouse? When an analyst runs SELECT AVG(capacity_factor) FROM wind_ops.gold.fleet_daily WHERE state = 'TX', what happens between the keystroke and the result?

What a SQL warehouse is #

SQL warehouse A dedicated compute endpoint in Databricks optimized for SQL analytics workloads. Unlike an all-purpose cluster (which supports notebooks, Python, Scala, and interactive development), a SQL warehouse accepts only SQL queries and is tuned for BI query patterns: fast startup, automatic scaling based on query queue depth, and automatic suspension when idle. It runs the Photon engine for vectorized query execution against Delta tables governed by Unity Catalog.

A SQL warehouse is not a separate product from Databricks – it is a different compute configuration on the same platform. It reads from the same Delta tables, respects the same Unity Catalog permissions, and accesses the same data that your Spark jobs write to. The difference is in how compute is provisioned and optimized.

When an analyst submits a query through the SQL editor, Tableau, or the JDBC connector, the request hits the SQL warehouse. The warehouse parses and optimizes the query, reads the relevant Parquet files from cloud storage (using Delta Lake’s transaction log to know which files are current), executes the query using the Photon engine, and returns results. If the warehouse was suspended, it wakes up first – in seconds for serverless, in minutes for classic1.

graph TD
    A["Analyst
(SQL editor, Tableau, JDBC)"] --> Q["SQL Query"] Q --> SW["SQL Warehouse"] SW --> QO["Query Optimizer"] QO --> P["Photon Engine
(vectorized execution)"] P --> RC["Result Cache
(check first)"] P --> DC["Disk Cache
(local SSD)"] P --> CS["Cloud Storage
(S3/ADLS/GCS)"] CS --> DL["Delta Lake
(transaction log → file list)"] DL --> UC["Unity Catalog
(permissions check)"] style SW fill:#1b4332,color:#fff style P fill:#2d6a4f,color:#fff style UC fill:#40916c,color:#fff style DL fill:#52b788,color:#000

Three warehouse types #

Databricks offers three SQL warehouse types. The differences come down to where the compute runs, how fast it starts, and what performance features are available.

Classic #

The original warehouse type. Classic warehouses provision VMs in your cloud account (AWS, Azure, or GCP). They support Photon but nothing else from the advanced performance stack. Startup takes approximately 4 minutes because Databricks must provision and configure VMs from scratch. Classic warehouses are being phased out – Databricks recommends migrating to Pro or Serverless2.

Pro #

Pro warehouses also run in your cloud account, but they add Photon and Predictive I/O (prefetching data based on query patterns). Startup is still approximately 4 minutes. Pro is the middle ground: better performance than Classic, but without the startup speed or intelligent workload management of Serverless.

Serverless #

Serverless warehouses run in Databricks’ cloud account on pre-warmed compute pools. This is what enables the 2 to 6 second startup time – the VMs already exist, Databricks just assigns your query to available capacity. Serverless includes all performance features: Photon, Predictive I/O, and Intelligent Workload Management (IWM), which dynamically routes queries across available compute to minimize queue wait times3.

Intelligent Workload Management (IWM) A serverless-only feature that dynamically manages how queries are distributed across compute resources. Instead of rigid cluster-based scaling (add a whole new cluster when the queue is full), IWM can adjust resource allocation at a finer granularity, responding to changing query demand more quickly and cost-effectively than manual or rules-based auto-scaling.

FeatureClassicProServerless
Startup time~4 min~4 min2-6 sec
PhotonYesYesYes
Predictive I/ONoYesYes
Intelligent Workload ManagementNoNoYes
Compute locationYour accountYour accountDatabricks account
Auto-scaling responsivenessSlow (full VMs)Slow (full VMs)Fast (pre-warmed)

For your wind utility: Use Serverless. The 15 analysts query intermittently throughout the day. Serverless starts instantly when someone opens a dashboard, scales up during the Monday morning operations meeting when everyone queries at once, and suspends when nobody is running queries. You pay only for active compute time.

What Photon actually does #

Photon A query execution engine written in C++ that replaces Spark’s JVM-based execution layer for SQL workloads. Photon processes data in columnar batches using SIMD (Single Instruction, Multiple Data) CPU instructions, achieving 3x to 10x speedups over standard Spark SQL for typical analytics queries. It is not a separate product – it is the execution engine inside SQL warehouses and can be enabled on all-purpose clusters.

Photon is often described as “Databricks’ faster engine” or “C++ instead of JVM.” That is technically true but misses the important part. The performance gain comes from a fundamentally different execution model, not just a language change.

Row-at-a-time vs. vectorized execution #

Traditional Spark SQL processes data through a tree of operators (scan, filter, aggregate, join). Each operator processes one row at a time, calling virtual functions to evaluate expressions. This is flexible – you can plug in any expression – but it has overhead. Every row means a function call. Every function call means branch prediction, instruction cache misses, and no opportunity for the CPU to use its widest data paths.

Photon switches to vectorized execution: operators process batches of values (typically 1024 or more) stored in columnar format. Instead of evaluating temperature > 35.0 one row at a time, Photon loads a batch of temperature values into a contiguous memory buffer and applies the comparison to the entire batch using SIMD instructions. One CPU instruction compares 4, 8, or 16 values simultaneously4.

-- This query benefits enormously from vectorized execution
SELECT
    turbine_id,
    AVG(capacity_factor) AS avg_cf,
    COUNT(*) AS hours
FROM wind_ops.gold.fleet_hourly
WHERE state = 'TX'
  AND month >= '2026-01'
  AND capacity_factor > 0.2
GROUP BY turbine_id
ORDER BY avg_cf DESC
LIMIT 20;

For this query, Photon:

  1. Scans the state column as a contiguous batch, filters to ‘TX’ using SIMD string comparison
  2. Scans month and capacity_factor columns in batch, applies both filters simultaneously
  3. Hashes turbine_id values in batch for the GROUP BY
  4. Aggregates capacity_factor values using vectorized SUM and COUNT operations
  5. Sorts the results in batch for ORDER BY

Each step processes thousands of values per CPU instruction cycle instead of one. The SIGMOD 2022 paper on Photon reports that this approach, combined with the move from JVM to native C++ (eliminating garbage collection pauses and enabling direct memory management), produces 3x average speedups with peaks above 10x for scan-heavy queries5.

What Photon does not do #

Photon is not a full replacement for Spark. It accelerates a subset of operations – primarily the scan, filter, aggregation, join, and sort operations that dominate SQL analytics workloads. Complex UDFs, Python-based transformations, and some Spark-specific operations still fall back to the JVM engine. This is transparent to the user – the query optimizer decides which parts to execute in Photon and which to execute in Spark6.

For the wind utility’s analysts, this does not matter. Their queries are exactly the kind Photon accelerates: filter by turbine, group by time period, aggregate capacity factors, join with weather data. Pure SQL analytics.

When Photon doesn’t help #

Not every query benefits from Photon:

  1. Python UDFs – If your query calls a Python function (CREATE FUNCTION ... LANGUAGE PYTHON), that function runs in a separate Python interpreter, bypassing Photon entirely. The scan and join might be Photon-accelerated, but the UDF is a bottleneck.
  2. Deeply nested JSON – Photon works on flat columnar data. If your query repeatedly extracts fields from deeply nested VARIANT/JSON columns, the extraction overhead can negate the vectorization benefit.
  3. Network-bound queries – If your query shuffles more data than it computes (e.g., a massive cross-join), Photon makes the compute faster but the network transfer is unchanged. The bottleneck shifts, not shrinks.
  4. Very small queries – Sub-second queries on tiny datasets don’t benefit from vectorization because the overhead of setting up the Photon execution context exceeds the computation time.

To check if Photon accelerated your query: open the Query Profile in the DBSQL UI. Photon-accelerated operators appear as PhotonGroupBy, PhotonHashAggregate, PhotonHashJoin, etc. If you see standard Spark operators (HashAggregate, SortMergeJoin), that portion fell back to the JVM engine.

The cost model #

DBU (Databricks Unit) The billing unit for Databricks compute. One DBU represents a normalized unit of processing capability per hour. The dollar cost per DBU varies by workload type, cloud provider, and tier. DBU consumption depends on the size of the cluster or warehouse – a larger warehouse uses more DBUs per hour but completes queries faster.

Understanding DBSQL pricing requires knowing that you pay two bills: one to Databricks (DBU charges) and one to your cloud provider (VM and storage costs). For serverless warehouses, the cloud compute cost is included in the DBU rate7.

Current AWS Premium tier DBU rates (as of early 2026):

Workload typeDBU rate ($/hour)Notes
SQL Serverless$0.70Includes cloud compute
SQL Pro$0.55+ separate cloud VM costs
All-Purpose Compute$0.55For notebooks, interactive dev
Jobs Compute$0.30For scheduled production jobs
Jobs Lite Compute$0.22For lightweight jobs

The serverless rate looks higher ($0.70 vs. $0.55 for Pro), but it includes the underlying VM cost. When you add the AWS EC2 bill to Pro warehouse costs, serverless is often comparable or cheaper – especially for bursty analyst workloads where auto-suspend matters8.

Right-sizing for the wind utility #

A small SQL warehouse (2X-Small, roughly 1 cluster unit) consumes about 4 DBUs per hour on serverless. At $0.70/DBU, that is $2.80/hour of active compute. With auto-suspend set to 10 minutes, an analyst who runs queries for 30 minutes in the morning and 30 minutes in the afternoon uses about 1.5 hours of compute – roughly $4.20/day.

For 15 analysts, assuming some concurrency (dashboards refreshing, overlapping queries), a Small warehouse (8 DBUs/hour) with auto-scaling might cost $40-60/day during active hours. That is $800-1200/month – far less than running a dedicated Spark cluster 24/7 or maintaining a separate Snowflake deployment for the same workload.

The key cost levers:

  • Auto-suspend: Aggressively suspend when idle. 10 minutes is the default; 5 minutes works for interactive use.
  • Right-size: Start small, let auto-scaling handle peaks. A 2X-Small warehouse handles most single-user queries fine.
  • Result caching: Repeated queries (dashboard refreshes) hit the cache instead of consuming compute. This is free.
  • Serverless over Pro/Classic: Faster suspend/resume means less idle compute time. The per-DBU premium often pays for itself.

Estimating your monthly DBSQL cost #

For the wind utility (15 analysts, ~100 queries/day, average query duration 5 seconds on a Medium serverless warehouse):

Warehouse size: Medium = 8 DBUs/hour
Active query time: 100 queries x 5 sec = 500 sec/day ~ 0.14 hours/day
Daily DBU consumption: 8 x 0.14 = 1.1 DBUs/day
Monthly DBU consumption: 1.1 x 22 workdays = 24.2 DBUs/month
Monthly cost: 24.2 x $0.70 (serverless rate) = ~$17/month

But: the warehouse stays running during active periods.
With auto-suspend at 10 minutes and 8 hours of analyst activity:
Warm hours: ~4 hours/day (clustered analyst activity with idle gaps)
Monthly warm DBUs: 8 x 4 x 22 = 704 DBUs/month
Monthly cost: 704 x $0.70 = ~$493/month

The real cost is the warm time, not the query time. Serverless warehouses (~2 second startup) minimize warm time because they can suspend aggressively. Pro warehouses (5-10 minute startup) stay warm longer to avoid startup delays. This is why serverless is usually cheaper despite the higher per-DBU rate.

Key takeaway: A SQL warehouse is a dedicated, SQL-only compute endpoint powered by Photon’s vectorized C++ engine. Serverless warehouses start in seconds, scale automatically, and suspend when idle – making them dramatically more suitable for analyst workloads than all-purpose Spark clusters. The cost model rewards right-sizing and auto-suspend, which matters when you have 15 analysts with intermittent query patterns.


  1. SQL warehouse types – architecture and feature comparison of Classic, Pro, and Serverless. ↩︎

  2. SQL warehouse types – Databricks recommends serverless for most workloads. ↩︎

  3. SQL warehouse sizing and scaling – Intelligent Workload Management and auto-scaling behavior. ↩︎

  4. What is Photon? – Databricks documentation on the Photon execution engine. ↩︎

  5. Photon: A Fast Query Engine for Lakehouse Systems – SIGMOD 2022 paper describing Photon’s vectorized architecture and performance benchmarks. ↩︎

  6. Photon product page – overview of which operations Photon accelerates and fallback behavior. ↩︎

  7. Databricks SQL Pricing – official DBU rates for SQL warehouse types. ↩︎

  8. Databricks Pricing Explained – analysis of total cost including cloud compute charges. ↩︎