Lakehouse Digest
ISSUE 018 · OCTOBER 6, 2026

Your time travel expires in 7 days, not 30

Delta history may list 30 days of versions, but time travel and RESTORE work only while both the transaction log and the version's data files survive. Audit both windows before VACUUM turns a visible version into an unreachable one.

THE THREE-PART READ

Retain. Rewind. Recover.

The version number is not the backup. A successful rewind requires both metadata and every data file referenced by that version.

TIP

Your practical window is seven days

Thirty days of transaction history cannot rescue data files already removed by VACUUM.

Understand the two clocks →
IMPLEMENTATION

Set both retention properties

Build three versions, inspect the history, see the trap, then align data and log retention with the SLA.

Run the walkthrough →
DEV Q&A

RESTORE failed. What now?

Quantify any partial recovery, or rebuild from the replayable bronze or landing source.

Review the recovery order →

Last verified against official Databricks documentation: October 6, 2026. Correction history: first publication — no corrections.

Two retention clocks control one rewind

Your rewind is 7 days, not 30. Delta Lake time travel and RESTORE reach back only as far as BOTH the transaction log and the deleted data files survive. delta.logRetentionDuration (default interval 30 days) controls how long table history is kept; delta.deletedFileRetentionDuration (default interval 7 days) controls the threshold VACUUM uses to physically delete data files no longer referenced by the current version. To query a previous table version, you must retain both the log and the data files for that version (official docs).

On Databricks Runtime 18.0 and above, time travel queries are blocked if they request a version older than the deletedFileRetentionDuration table property; for Unity Catalog managed tables this applies from Databricks Runtime 12.2. VACUUM never touches the log — log files are deleted automatically and asynchronously after checkpoint operations and are not governed by VACUUM — but once VACUUM removes a version's data files, the log entry for that version points at files that no longer exist.

OSS Delta Lake has the same defaults and machinery (interval 30 days log, interval 1 week deleted-file) — this is not Databricks-only behavior.

Official guidance: “Databricks doesn't recommend using table history as a long-term backup solution for data archival. Use only the past 7 days for time travel operations unless you have set both data and log retention configurations to a larger value.”

Illustrative walkthrough

Reproducible, idempotent setup:

CREATE OR REPLACE TABLE demo.orders_rewind (order_id BIGINT, amount DOUBLE, dt DATE);
INSERT INTO demo.orders_rewind VALUES (1, 99.50, DATE '2026-09-01'), (2, 149.00, DATE '2026-09-02');  -- version 0
UPDATE demo.orders_rewind SET amount = 109.50 WHERE order_id = 1;  -- version 1
DELETE FROM demo.orders_rewind WHERE order_id = 2;  -- version 2
SELECT version, operation FROM (DESCRIBE HISTORY demo.orders_rewind) ORDER BY version;  -- expected output: 0/WRITE, 1/UPDATE, 2/DELETE
SELECT * FROM demo.orders_rewind VERSION AS OF 0 ORDER BY order_id;  -- expected output: 2 rows: (1, 99.50), (2, 149.00)

Then the trap

DEMO ONLY — do not run on a table you may need to rewind.
VACUUM demo.orders_rewind RETAIN 24 HOURS;

After this, version 0's data files are physically gone while the log still lists version 0. The query fails on missing files; on DBR 18+ it is blocked outright.

What is guaranteed by the docs is the loss of reachability (“If you run a VACUUM on a Delta table, you lose the ability to time travel back to a version older than the specified data retention period.” / “The ability to query table versions older than the retention period is lost after running VACUUM.”) — not any specific error message.

The policy fix: set BOTH windows before you need them

ALTER TABLE demo.orders_rewind SET TBLPROPERTIES ('delta.deletedFileRetentionDuration' = 'interval 30 days', 'delta.logRetentionDuration' = 'interval 30 days');
-- defaults for NEW tables in this session:
SET spark.databricks.delta.properties.defaults.deletedFileRetentionDuration = 'interval 30 days';
SET spark.databricks.delta.properties.defaults.logRetentionDuration = 'interval 30 days';

Note: on Databricks Runtime 18.0+, logRetentionDuration must be greater than or equal to deletedFileRetentionDuration.

Saveable diagnostic query

SHOW TBLPROPERTIES demo.orders_rewind ('delta.deletedFileRetentionDuration', 'delta.logRetentionDuration');
DESCRIBE HISTORY demo.orders_rewind LIMIT 3;

These tell you both retention windows and the oldest version still listed. If the rewind you need exceeds either property, the rewind is already impossible: fix the properties first.

Documentation boundary: Do NOT present delta.checkpointRetentionDuration's 2-day default as Databricks-documented (it is only verifiable via OSS Delta internals references).
“My RESTORE TO VERSION AS OF failed. How do I get the data back?”

Check DESCRIBE HISTORY first. The docs are explicit: “You cannot restore a table to an older version where the data files were deleted manually or by vacuum.”

Recovery options in order:

  1. Partial restore with SET spark.sql.files.ignoreMissingFiles = true — the restore skips missing files, so rows are lost; acceptable only if you can quantify the gap.
  2. Rebuild from your bronze/landing replayable source — the only true recovery, and exactly why table history is not a backup.

Caution on success: RESTORE is a data-changing operation — log entries added by the RESTORE command contain dataChange set to true — so downstream streaming readers treat it as new data: re-run downstream validation after any restore.

Use this when

  1. You run GDPR/right-to-erasure workflows: the 7-day default is your friend — deleted data becomes physically unqueryable fast, and the docs pair deletion with VACUUM.
  2. Your rollback/audit SLA needs a 30-day rewind: set BOTH delta.deletedFileRetentionDuration and delta.logRetentionDuration to interval 30 days (they must match; on DBR 18+ the log window must be >= the deleted-file window).

Avoid this when

  1. Raising deletedFileRetentionDuration on high-churn tables “just in case”: you pay storage for every deleted file retained, and VACUUM automation respects your configured window, so the bill compounds.
  2. Running VACUUM ... RETAIN 24 HOURS (or any retention below your rewind SLA) on a table anyone might time-travel: the rewind dies the moment the files are gone, permanently.
Documentation boundary: Never present a checkpoint-retention claim as Databricks-documented.
Assumptions: Delta Lake tables (managed or external). Hard block on DBR 18.0+; Unity Catalog managed tables: DBR 12.2+. OSS Delta Lake shares the same defaults and two-window mechanics.
Provenance: Last verified against official Databricks documentation: 2026-10-06. Correction history: first publication — no corrections.
RECOMMENDED LEARNING

Make retention an explicit architecture decision.

Deepen the Delta Lake and data engineering foundations behind durable rollback, replay, and table maintenance.

BUILD THE FOUNDATION

Databricks fundamentals

Strengthen the platform basics behind Delta tables, transaction history, jobs, and production data workflows.

Browse DataCamp Databricks courses →
BUILD FOR RECOVERY

Data engineering workflows

Practice replayable pipelines, bronze-layer recovery, and validation patterns for production incidents.

Browse DataCamp data engineering →
SAVE THIS

Two commands before every rewind promise

Show both table properties, then inspect history. A listed version is not proof its data files still exist.

Save the diagnostic →

Partner links: we may earn a commission if you enroll through these recommendations, at no extra cost to you.

Primary sources

Official documentation

  1. Table properties and table options — Azure Databricks: verifies the delta.deletedFileRetentionDuration and delta.logRetentionDuration property roles. The defaults and spark.databricks.delta.properties.defaults.<conf> mechanism are covered in the Delta table properties reference.
  2. Work with table history — Azure Databricks: verifies history retention, the requirement to keep both log and data files, 7-vs-30 guidance, the DBR 18.0+/UC 12.2+ rule, RESTORE reachability, and the dataChange note.
  3. VACUUM — Databricks SQL language reference: verifies that _delta_log is skipped and that time travel older than the retention period is lost after VACUUM.
  4. Remove unused data files with vacuum — Databricks: verifies retention behavior, longer-window configuration, and the loss of queryability for old versions.
  5. Prepare your data for GDPR compliance — Azure Databricks: verifies the 30-day table-history default and the 7-day time-travel window after default VACUUM behavior.
  6. Delta Lake table streaming reads and writes — Databricks: verifies the 7-day data-file and 30-day transaction-log windows for streaming readers.

Practitioner reference

  1. BricksNotes / Towards Data Engineering (April 24, 2026) — practitioner case study, not official documentation. A team ran VACUUM RETAIN 24 HOURS on a roughly 2 TB table; two days later VERSION AS OF 142 failed because the Parquet files were gone while log metadata survived, so they rebuilt from bronze.