Delta Lake on Databricks: ACID Transactions, Time Travel, and Schema Evolution Explained

Celestinfo Software Solutions Pvt. Ltd. • Aug 21, 2025

Last updated: October 2026

Quick answer: Delta Lake is an open-source storage layer that adds ACID transactions to Parquet files on S3, ADLS, or GCS. It enables UPDATE, DELETE, and MERGE operations that plain Parquet can't do, plus time travel (query historical versions), schema evolution, and data layout features for query performance. Databricks recommends liquid clustering for new tables, and predictive optimization runs OPTIMIZE and VACUUM automatically on Unity Catalog managed tables. On Databricks, Delta is the default table format. Key gotcha: data file retention, 7 days by default, limits how far back time travel can go.

Introduction

Plain Parquet files on a data lake give you cheap storage and fast columnar reads. They don't give you transactions, updates, or deletes. If your pipeline writes a batch of files and crashes halfway through, readers see a partially-written, inconsistent dataset. Delta Lake solves this by adding a transaction log on top of Parquet, turning your data lake into something that behaves more like a database. This guide covers every Delta Lake feature you'll actually use, with SQL examples and the performance gotchas you'll hit. For a broader comparison of where Delta Lake fits versus a traditional warehouse, see our Databricks vs. Snowflake comparison.

How the Transaction Log Works

Every Delta table has a _delta_log directory containing JSON files that record every operation: which Parquet files were added, which were removed, metadata changes, and schema changes. Each JSON file represents one commit (one atomic transaction). When you read a Delta table, the engine replays the log to determine which files constitute the current version.

Periodically, Delta writes a checkpoint file (in Parquet format) that consolidates the log state. The open-source protocol's default is a checkpoint every 10 commits, while Databricks tunes the frequency for each table based on data size and workload. This means reads only need to find the latest checkpoint and replay the few commits after it, rather than scanning the entire log history. For tables with thousands of commits, checkpoints are what keep read performance acceptable.

CRUD Operations: What Parquet Can't Do

Plain Parquet is append-only. Delta Lake makes Parquet files mutable through the transaction log:

-- INSERT works the same as plain Parquet
INSERT INTO sales.orders VALUES (1001, '2026-02-27', 'SHIPPED', 149.99);

-- UPDATE: rewrites the affected files, or marks rows in metadata if the
-- table uses deletion vectors
UPDATE sales.orders SET status = 'DELIVERED' WHERE order_id = 1001;

-- DELETE: same mechanism, old files removed, remaining rows written to new files
DELETE FROM sales.orders WHERE order_date < '2024-01-01';

-- MERGE (upsert): the most useful operation for ETL
MERGE INTO sales.orders AS target
USING staging.new_orders AS source
ON target.order_id = source.order_id
WHEN MATCHED THEN UPDATE SET *
WHEN NOT MATCHED THEN INSERT *;

Without deletion vectors, UPDATE and DELETE rewrite the affected Parquet files entirely, so updating one row in a 100 MB file writes a new 100 MB file. With deletion vectors, changed rows are marked in metadata instead, and the files are rewritten later by OPTIMIZE, REORG TABLE ... APPLY (PURGE) or auto-compaction. A workspace setting can enable deletion vectors for new tables on SQL warehouses and Databricks Runtime 14.3 LTS and above, and the default varies by region, so check delta.enableDeletionVectors in the table properties of tables with frequent small updates.

Building this out on your own stack? We build data platforms end to end: ingestion, transformation, orchestration, and the alerting that catches a broken load before your users find it. You get running pipelines and the runbook to operate them, not a reference architecture.

Book a platform call Data engineering services

Time Travel

Every commit creates a new version. You can query any historical version by version number or timestamp:

-- Query by version number
SELECT * FROM sales.orders VERSION AS OF 42;

-- Query by timestamp
SELECT * FROM sales.orders TIMESTAMP AS OF '2026-02-20 10:00:00';

-- Restore a table to a previous version (undo accidental changes)
RESTORE TABLE sales.orders TO VERSION AS OF 42;

-- View the history of all operations on a table
DESCRIBE HISTORY sales.orders;

Critical gotcha: Time travel only works while the underlying Parquet files are retained. The table property delta.deletedFileRetentionDuration, 7 days by default, sets that window, and log retention defaults to 30 days. In Databricks Runtime 18.0 and above, and from Runtime 12.2 for Unity Catalog managed tables, Databricks blocks time travel to versions older than delta.deletedFileRetentionDuration whether or not VACUUM has run, and in Runtime 18.0 and above delta.logRetentionDuration must be at least as long. Plan your retention based on how far back you actually need to query.

Schema Evolution

Delta Lake lets you add columns freely, rename columns once column mapping is enabled on the table, and widen column types without rewriting data through type widening, for example INT to BIGINT or FLOAT to DOUBLE. Type widening needs Databricks Runtime 15.4 LTS and above, and tables that use it can only be read by Runtime 15.4 and above. Other type changes follow normal schema enforcement:

-- Add a column
ALTER TABLE sales.orders ADD COLUMN shipping_carrier STRING;

-- Enable automatic schema evolution during writes
SET spark.databricks.delta.schema.autoMerge.enabled = true;

-- Or use mergeSchema option in a specific write
df.write.format("delta") \
  .option("mergeSchema", "true") \
  .mode("append") \
  .saveAsTable("sales.orders")

With mergeSchema, if your source data has a new column that the target table doesn't, Delta Lake adds the column automatically. Existing rows get NULL for the new column. This is incredibly useful for sources with evolving schemas (APIs, event streams), but it can also mask problems, because a typo in a column name creates a new column instead of writing to the intended one. Review schema changes in DESCRIBE HISTORY regularly.

OPTIMIZE, Liquid Clustering and ZORDER

Streaming writes and frequent appends create lots of small files. Small files slow reads down, because the engine spends more time opening files than reading data. OPTIMIZE compacts small files into larger ones. For new tables, Databricks recommends liquid clustering, which replaces partitioning and ZORDER and can't be combined with ZORDER. Predictive optimization also runs OPTIMIZE, VACUUM and ANALYZE automatically on Unity Catalog managed tables, by default for accounts created on or after 11 November 2024, so many teams no longer schedule these commands themselves.

-- New tables: liquid clustering instead of partitioning and ZORDER
CREATE TABLE sales.orders_v2 (
  order_id BIGINT, order_date DATE, region STRING, amount DECIMAL(12, 2)
)
CLUSTER BY (order_date, region);

-- Existing tables without liquid clustering: compact, optionally with ZORDER
OPTIMIZE sales.orders;
OPTIMIZE sales.orders ZORDER BY (order_date, region);

ZORDER rearranges data within files so that rows with similar values for the specified columns are stored together. This enables file skipping: if you query WHERE region = 'US-EAST', Databricks can skip files that don't contain any US-EAST data. ZORDER remains useful on existing tables that don't use liquid clustering.

Gotcha: choose ZORDER columns that appear in query filters. Databricks' guidance is that a commonly filtered column with high cardinality, such as user_id, is a good ZORDER candidate, because its many distinct values give file skipping plenty to work with. Each extra column reduces the benefit for the others, so two columns is usually the sweet spot and more than three gives diminishing returns.

VACUUM: Storage Management

Every UPDATE, DELETE, and OPTIMIZE creates new Parquet files while the old ones remain for time travel. VACUUM removes files that are no longer referenced by any version within the retention period:

-- Remove files older than 7 days (default)
VACUUM sales.orders;

-- Remove files older than 168 hours explicitly
VACUUM sales.orders RETAIN 168 HOURS;

-- DRY RUN: see what would be deleted without actually deleting
VACUUM sales.orders DRY RUN;

Always run VACUUM DRY RUN first on important tables. And remember: reducing retention below 7 days requires setting delta.deletedFileRetentionDuration on the table and disabling the safety check with spark.databricks.delta.retentionDurationCheck.enabled = false. Think twice before doing this, because if someone needs to restore data from 3 days ago and you set retention to 24 hours, that data is gone.

Lakeflow Pipelines (formerly Delta Live Tables)

Lakeflow pipelines, the product formerly known as Delta Live Tables, are Databricks' declarative pipeline framework built on Delta Lake. Instead of writing imperative ETL code (read from source, transform, write to target), you declare what the output table should look like and the pipeline works out the execution. Existing DLT code keeps working, and in Python the module is now imported with from pyspark import pipelines as dp.

-- Declare a streaming table that reads JSON files incrementally with Auto Loader
CREATE OR REFRESH STREAMING TABLE raw_events
AS SELECT * FROM STREAM read_files('/data/events/', format => 'json');

-- Declare a materialized view with quality expectations
CREATE OR REFRESH MATERIALIZED VIEW clean_orders (
  CONSTRAINT valid_amount EXPECT (amount > 0) ON VIOLATION DROP ROW
)
AS SELECT order_id, customer_id, amount, order_date
FROM raw_events
WHERE event_type = 'ORDER';

The LIVE. prefix used in older examples is deprecated, and in the default publishing mode it is silently ignored, so the example reads raw_events directly. The EXPECT constraint is the pipelines' built-in data quality feature. Rows that fail the expectation are either dropped, flagged, or cause the pipeline to fail, depending on the ON VIOLATION setting. This replaces a lot of manual data quality code. For managing the compute behind these pipelines, see our guide on managing compute workloads for ETL vs. analytics.

Delta Lake vs. Apache Iceberg vs. Hudi

All three are open table formats that add ACID transactions to data lakes. The practical differences:

Databricks also supports Iceberg directly. UniForm writes Delta tables that are also readable as Iceberg tables, Unity Catalog can create managed Iceberg tables (Databricks Runtime 16.4 LTS and above), its Iceberg tables are exposed through an Iceberg REST Catalog API, and it can read foreign Iceberg tables from other catalogs. So it's not entirely an either/or choice anymore.

Key Takeaways

CelestInfo Engineering Team

We build lakehouse architectures on Databricks and Snowflake. Delta Lake, Iceberg, or both - we'll help you pick what fits. About us

Related Articles

Burning Questions About Delta Lake

Quick answers to what teams ask us most

Time travel to versions older than the retention window stops working, because the files those versions need are deleted. Retention is set by delta.deletedFileRetentionDuration, 7 days by default, and in Databricks Runtime 18.0 and above (and from 12.2 for Unity Catalog managed tables) Databricks blocks time travel beyond it even before VACUUM runs. Running VACUUM below the default also requires disabling the retention safety check.

Yes, if queries filter on them. Databricks' guidance is to ZORDER columns that are commonly used in query predicates, and high-cardinality columns such as user_id are good candidates. For new tables, Databricks recommends liquid clustering instead of ZORDER.

Both provide ACID transactions and time travel on data lakes. Delta Lake has tighter Databricks integration (Unity Catalog, Lakeflow pipelines, Photon). Iceberg has broader multi-engine support (Spark, Trino, Flink, Dremio, Snowflake) and suits vendor-neutral architectures. Databricks now also supports managed Iceberg tables in Unity Catalog, so the two can sit side by side.

The transaction log (_delta_log directory) is a series of JSON files that records every change to a Delta table: which Parquet files were added, removed, or modified, plus metadata and schema changes. It's what makes ACID transactions possible on object storage. Delta periodically writes a checkpoint file (Parquet format) so reads don't have to replay the entire log history; Databricks tunes how often for each table.

Ready? Let's Talk!

Get expert insights and answers tailored to your business requirements and transformation.

Get Assistance