Skip to the page
Tecyfy

Delta Lake time travel: how far back you can go, and how to keep more

By default a Delta table's time travel reaches back 7 days, even though DESCRIBE HISTORY lists 30. The 2 table properties that decide it, why both must move together, what a longer history costs in storage, and when a monthly deep clone is the better way to keep the past.

Tecyfy · Published · 7 min read

Blueprint of an hourglass beside a long row of filing drawers, the far ones empty, labelled Delta

By default you can time travel 7 days back on a Delta table, not 30. DESCRIBE HISTORY lists 30 days of versions, because the transaction log is kept that long, but a version also needs its data files, and VACUUM deletes replaced files after 7 days. On Databricks Runtime 18.0 and above, and on Unity Catalog managed tables from Runtime 12.2, a query older than that limit is refused outright.

That gap surprises people at the worst moment: someone finds a bad MERGE from 10 days ago, sees the version in the history, and cannot read it. This article is about how far back you can go and how to go further. How time travel and RESTORE work is in part 1 of our Delta Lake course module, and what VACUUM deletes is in VACUUM LITE explained.

The 2 settings

Table propertyDefaultDecidesCleaned by
delta.logRetentionDuration30 daysHow long versions are listed in the historyAutomatically, after checkpoints
delta.deletedFileRetentionDuration7 daysHow long a replaced data file survives VACUUMVACUUM

The shorter of the 2 is your time travel limit. Raising only the log retention lengthens the history list but not what you can read. Raising only the file retention does nothing past 30 days, because the log entries go. On Databricks Runtime 18.0 and above, and Unity Catalog managed tables, the log retention must be at least the file retention.

On Unity Catalog managed tables, predictive optimization runs VACUUM for you, so the 7-day limit applies whether or not anyone schedules a vacuum. In open-source Delta Lake, data files are deleted only when someone runs VACUUM, but the log still goes after 30 days.

To keep 90 days, set both:

ALTER TABLE main.sales.orders SET TBLPROPERTIES (
  'delta.deletedFileRetentionDuration' = 'interval 90 days',
  'delta.logRetentionDuration' = 'interval 90 days'
);

-- 60 days later, this still works:
SELECT * FROM main.sales.orders TIMESTAMP AS OF date_sub(current_date(), 60);

What longer history costs

Every UPDATE, MERGE, DELETE and OPTIMIZE writes new files and marks old ones as removed. Those removed files are what time travel reads, and they stay on storage for the whole retention period. So the extra storage is roughly what your daily changes replace, times the days you keep.

Take a 2 TB table where each day's MERGE rewrites files holding 5% of it, 100 GB a day, on S3 Standard at $0.023 per GB a month:

Time travel windowRemoved files keptExtra storage a monthTable plus history
7 days (default)700 GB$16.10$62.10
30 days3 TB$69.00$115.00
90 days9 TB$207.00$253.00
365 days36.5 TB$839.50$885.50

A year of daily history costs over 18 times what the table itself does ($46 a month). The table's size matters less than how much of it changes: an append-only table removes almost nothing and keeps history cheaply, while a table rewritten every night keeps a full copy for every day.

Try itWhat a longer time travel window costs
2000GB
5%
90days
90 days of history$253
12 monthly clones$598

The table Removed files kept for time travel Clones

History costs 4.5× the tableHistory costs lessRaise both retention settings

A 2.0 TB table replacing 5% a day keeps 9.0 TB of removed files for 90 days of time travel: $207 a month on top of $46 for the table. 12 monthly clones would cost $552.

S3 Standard at $0.023 per GB a month (first 50 TB, US East). Removed files kept is the daily share replaced times the days kept; OPTIMIZE and deletion vectors change how much a write replaces, so check your table's real numbers in DESCRIBE HISTORY's operation metrics.

When to keep copies instead

Databricks says not to use table history as a long-term backup. For anything you must keep (month-end figures, the data a model was trained on, an audit snapshot), take a deep clone: an independent copy at one version, which VACUUM on the source never touches.

-- Month-end snapshot, kept as its own table
CREATE TABLE main.archive.orders_2026_10 DEEP CLONE main.sales.orders;

-- The exact data a model was trained on
CREATE TABLE main.ml.orders_train_v15 DEEP CLONE main.sales.orders VERSION AS OF 15;

12 month-end clones of the 2 TB table are 24 TB, $552 a month, against $839.50 of removed files for 365 days of history. Each clone holds the whole table, so for a table that changes little, a long retention can cost less; compare the 2 for your own table. A clone does not copy the source's history, only the version you clone.

If records must be gone for good (a deletion request, for example), long retention works against you: deleted rows stay readable in old files until VACUUM removes them after the retention period. With deletion vectors on, run REORG TABLE ... APPLY (PURGE) first, then let the retention pass and vacuum.

What to do

  1. Treat 7 days as your undo window unless you have changed both settings. Check with SHOW TBLPROPERTIES.
  2. If you need longer, raise both properties together, and estimate the storage from how much the table changes each day.
  3. For month-end, audit or training snapshots, deep clone on a schedule rather than keeping a year of history.
  4. Before a risky MERGE or backfill, note the version from DESCRIBE HISTORY ... LIMIT 1, so RESTORE TABLE ... TO VERSION AS OF is one line if it goes wrong.

The format itself is explained in Delta LakeDelta LakeAn open table format that turns Parquet files in cloud storage into a table with transactions, a version history, schema checks, and updates and deletes, so a data lake behaves like a database., and how Delta compares with Iceberg on history and maintenance is in Delta Lake vs Apache Iceberg.

Questions

How far back can Delta Lake time travel go?
7 days by default. Time travel needs both a version's log entry and its data files. The log is kept 30 days (delta.logRetentionDuration), but VACUUM deletes data files removed more than 7 days ago (delta.deletedFileRetentionDuration), and on Databricks Runtime 18.0 and above, and Unity Catalog managed tables from Runtime 12.2, queries older than that 7 days are blocked.
Why does DESCRIBE HISTORY show versions I cannot time travel to?
Because history and time travel have different limits. DESCRIBE HISTORY reads the transaction log, kept 30 days by default. Time travel also needs the version's data files, which VACUUM deletes after 7 days by default. A version can be listed in the history after its files are gone.
How do I keep 90 days of Delta table history?
Set both properties: ALTER TABLE t SET TBLPROPERTIES ('delta.deletedFileRetentionDuration' = 'interval 90 days', 'delta.logRetentionDuration' = 'interval 90 days'). The log retention must be at least the file retention. Expect storage to grow by the data each day's changes replace, times 90.
Should I use Delta time travel as a backup?
No. Databricks advises against using table history for long-term backup or archiving and recommends keeping time travel to the past 7 days unless you raise both retention settings. For copies you must keep, deep clone the table on a schedule; a clone is an independent table that VACUUM on the source does not touch.
Does VACUUM delete the Delta transaction log?
No. VACUUM deletes data files. Log entries are removed separately, automatically after checkpoints, once they are older than delta.logRetentionDuration (30 days by default).