Skip to main content

Our nightly batch ETL is slow, and the business necessitates real-time dashboards. What's the best way to do this, and how do we migrate?

Summary

  • The fix for slow nightly batch ETL is incremental processing: ingest only new or changed data, update tables as it arrives, and stop recomputing everything once a night.
  • On Databricks, Lakeflow Pipelines builds streaming tables for ingestion and materialized views for transformations, and both run in triggered or continuous mode, so raising freshness doesn't mean rewriting tables.
  • A materialized view returns results equivalent to the batch query it replaces, and on serverless compute Databricks refreshes many of them incrementally.
  • Migrate one dataset at a time: keep nightly runs for low-priority data, backfill history with a one-time flow, and compare outputs before retiring the batch job.
  • For dashboards that also need sub-second responses, Lakehouse//RT (Beta) is a SQL warehouse type for read-only queries on Unity Catalog tables.

Our nightly batch ETL is slow, and the business necessitates real-time dashboards. What's the best way to do this, and how do we migrate?

Replace the nightly full recompute with incremental processing, then raise freshness one dataset at a time. On Databricks, ingest with Auto Loader, Lakeflow Connect, or a message bus into streaming tables, rewrite the nightly aggregates as materialized views, and run the pipelines behind real-time dashboards continuously. Keep the nightly job for data nobody needs intraday, and you avoid a risky rip-and-replace.

Why does nightly batch ETL fall short for real-time dashboards?

A nightly job processes the day's data in one window, so dashboards show yesterday until it lands, and a long or failed run delays everything. Batch jobs also tend to recompute full tables, so runs get heavier as data grows. Incremental processing handles only what changed, so you can run it often or keep it running.

Which processing mode fits each dataset?

Mode How it processes data Good fit Trade-off
Nightly batch Recomputes tables on a fixed schedule Historical and archival reporting Data is only as fresh as the last run
Triggered pipeline Refreshes the data available when the update starts, then stops Data that can wait for the next update New data waits for the next trigger
Continuous pipeline Processes new data as it arrives at the sources Operational dashboards Needs always-running compute, which costs more

Pipeline mode is independent of table type: streaming tables and materialized views can each run in either mode.

How do you migrate from nightly batch to streaming?

1. Rank datasets by freshness need. Start with the tables behind operational dashboards, such as orders or inventory. Leave historical reporting on the nightly schedule.
2. Make ingestion incremental. Auto Loader incrementally processes new files as they arrive in cloud storage. Lakeflow Connect's managed connectors ingest all selected data on the first run, then only changed data on later runs, when possible. Message buses such as Apache Kafka feed streaming tables directly as Structured Streaming sources.
3. Rewrite nightly aggregates as materialized views. Materialized views guarantee results equivalent to batch queries. When you create them with a SQL warehouse or serverless Lakeflow Pipelines, Databricks refreshes them incrementally if their queries are supported, recomputing only the results affected by changed source data. This docs example turns a batch aggregate into a materialized view:

CREATE OR REPLACE MATERIALIZED VIEW transaction_summary AS
SELECT account_id,
  COUNT(txn_id) txn_count,
  SUM(txn_amount) account_revenue
FROM transactions_table
GROUP BY account_id

4. Backfill history in the same pipeline. A streaming table is owned and updated by a single pipeline, but several flows can append to it. Add a one-time append flow (INSERT INTO ONCE in SQL, once=True in Python) next to the ongoing streaming flow. It runs once, and runs again only if the pipeline is fully refreshed.
5. Validate, then cut over. Run the new pipeline alongside the nightly job, compare outputs for the same window, and retire the batch job once they match.

How does Databricks keep dashboards current?

Run priority pipelines with a continuous Lakeflow Job, which Databricks recommends over setting the pipeline's own mode to continuous. Delta Lake's ACID guarantees mean readers see a consistent snapshot of each table even while pipelines write to it, so AI/BI Dashboards built on those tables read a consistent view.
If dashboards also need sub-second responses at high concurrency, Lakehouse Real-Time (Lakehouse//RT) is a Beta serverless SQL warehouse type that runs read-only ANSI SQL queries on Unity Catalog Delta Lake and Apache Iceberg tables, including materialized views and streaming tables. It serves reads only, so your pipelines still keep the tables fresh. A workspace admin enables the Beta from the Previews page, in supported regions.

What are common questions about moving from batch to real-time?

Do I have to move all data to streaming?

No. Set the mode per pipeline: continuous for the data behind live dashboards, triggered on a schedule for everything else.

How do I handle late-arriving data?

Use a watermark, which specifies how long the stream waits for delayed events before it treats a time window as complete. Records that arrive after the threshold might be dropped. Materialized views process all required data on each update, even if it arrives late or out of order.

Does continuous processing cost more?

Yes, in compute terms. Triggered pipelines can reduce resource consumption because compute runs only long enough to update the pipeline. Continuous pipelines need always-running compute, which costs more but reduces processing latency. Reserve continuous mode for data where freshness matters.

Can I reprocess data if a bug slips through?

Yes. A full refresh requeries all previous data from the source to rebuild a streaming table. For a materialized view defined in Databricks SQL, REFRESH MATERIALIZED VIEW mv_name FULL reprocesses all source data.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.