Snowflake Time Travel and Fail-safe Guide

Snowflake Time Travel and Fail-safe: Your Safety Net Explained

Celestinfo Software Solutions Pvt. Ltd. • Feb 13, 2025

Last updated: October 2026

Quick answer: Time Travel lets you query, clone, or restore data as it existed at any point within your retention window, which can be set from 0 to 90 days depending on edition. Fail-safe adds 7 days of Snowflake-managed disaster recovery you can't access directly. Together, they protect you from accidental deletes, bad updates and dropped objects, at the cost of additional storage.

Time Travel: What You Can Do With It


Time Travel is Snowflake's mechanism for accessing historical data. Under the hood, Snowflake retains the old micro-partitions that would normally be garbage-collected after a DML operation. When you query with a Time Travel clause, Snowflake reads from those retained partitions instead of the current ones.


The retention window is controlled by DATA_RETENTION_TIME_IN_DAYS, which you can set at the account, database, schema, or table level:


EditionMinimumMaximumDefault
Standard0 days1 day1 day
Enterprise0 days90 days1 day
Business Critical0 days90 days1 day

SQL - Set Retention Per Table
-- Set 30-day retention on a critical table
ALTER TABLE production.orders SET DATA_RETENTION_TIME_IN_DAYS = 30;

-- Set 0 days on a staging table (no Time Travel needed)
ALTER TABLE staging.temp_load SET DATA_RETENTION_TIME_IN_DAYS = 0;

Querying Historical Data


Snowflake provides three ways to specify the point in time you want to query:


AT(TIMESTAMP)

SQL
-- Query orders as they existed yesterday at 2 PM
SELECT * FROM production.orders
AT(TIMESTAMP => '2026-02-26 14:00:00'::TIMESTAMP_LTZ);

AT(OFFSET)

SQL
-- Query orders as they existed 1 hour ago (offset in seconds)
SELECT * FROM production.orders
AT(OFFSET => -3600);

BEFORE(STATEMENT)

SQL
-- Query orders as they existed just BEFORE a specific query ran
SELECT * FROM production.orders
BEFORE(STATEMENT => '01b2c3d4-0000-0000-0000-000000000000');

The STATEMENT approach is the most precise. You can find the query ID in the query history, then recover data from just before that bad UPDATE or DELETE executed.


Undoing Mistakes: Three Recovery Patterns


Pattern 1: UNDROP a Dropped Table

Someone runs DROP TABLE production.orders. As long as you're within the retention period:

SQL
UNDROP TABLE production.orders;

The table comes back with its data and metadata. UNDROP fails if an object with the same name already exists, so if someone has already created a replacement table, rename it first. When several dropped tables share a name, UNDROP TABLE IDENTIFIER('<table id>') restores a specific one. UNDROP also works for schemas and databases:

SQL
UNDROP SCHEMA production;
UNDROP DATABASE analytics_db;

Pattern 2: Recover From a Bad UPDATE

Someone runs UPDATE orders SET status = 'cancelled' without a WHERE clause. Every row is now cancelled. Here's the fix:

SQL
-- Step 1: Clone the table from before the bad update
CREATE TABLE production.orders_recovered CLONE production.orders
  BEFORE(STATEMENT => '01b2c3d4-0000-0000-0000-000000000000')
  COPY GRANTS;

-- Step 2: Verify the recovered data looks correct
SELECT COUNT(*), COUNT(DISTINCT status)
FROM production.orders_recovered;

-- Step 3: Swap the tables
ALTER TABLE production.orders RENAME TO production.orders_bad;
ALTER TABLE production.orders_recovered RENAME TO production.orders;

-- Step 4: Clean up after verification
DROP TABLE production.orders_bad;

COPY GRANTS matters in this pattern. A cloned table does not inherit the explicit privileges granted on the original, only the future grants defined in the schema, so without it every role that could read production.orders loses access when the tables are swapped.


Pattern 3: Recover Deleted Rows

Someone deletes 50,000 rows that shouldn't have been deleted. Instead of restoring the whole table, extract just the missing rows:

SQL
-- Find rows that existed before but don't exist now
INSERT INTO production.orders
SELECT old.*
FROM production.orders AT(OFFSET => -3600) old
LEFT JOIN production.orders curr ON old.order_id = curr.order_id
WHERE curr.order_id IS NULL;

Want this running in your own account? We build Snowflake platforms end to end: ingestion, modelling, access control, and the monitoring that tells you when a load drifts. Not slide decks. Not roadmaps. Real working systems you can point at.

Book a Snowflake call Snowflake consulting

Fail-safe: The Last Resort


After your Time Travel retention window expires, Snowflake keeps the data for an additional 7 days in Fail-safe. You can't access this data yourself through SQL, the UI or any API. Only Snowflake support can attempt recovery from the Fail-safe period, and it is meant for disaster scenarios such as hardware failure or data corruption, not for routine recovery.


Fail-safe has real storage costs. For a 1 TB table with 1 day of Time Travel, you're paying for 1 TB of active storage + up to 1 day of Time Travel storage + 7 days of Fail-safe storage. On high-churn tables, this adds up.


Neither feature is designed for recovery points that must be kept for months. For that, Snowflake backups take point-in-time, immutable snapshots of tables, schemas or databases on a schedule you define. Backups are available on all editions. Retention lock, which stops any role, ACCOUNTADMIN included, from deleting a backup before it expires, and legal hold both require Business Critical Edition or higher.


Transient vs Permanent Tables


Snowflake offers transient tables specifically for data that doesn't need the full safety net:


FeaturePermanent TableTransient TableTemporary Table
Time Travel0-90 days0-1 day0-1 day
Fail-safe7 daysNoneNone
Persists across sessionsYesYesNo
Best forProduction dataStaging, ETL intermediariesSession-scoped temp work

SQL
-- Transient table: 0-1 day Time Travel, no Fail-safe
CREATE TRANSIENT TABLE staging.daily_load (
  id INT,
  payload VARIANT,
  loaded_at TIMESTAMP_NTZ DEFAULT CURRENT_TIMESTAMP()
)
DATA_RETENTION_TIME_IN_DAYS = 0;

-- Temporary table: exists only for the session
CREATE TEMPORARY TABLE session_scratch AS
SELECT * FROM production.orders WHERE order_date = CURRENT_DATE();

Using transient tables for staging data, ETL intermediaries, and temp tables can cut your storage bill significantly. A team we worked with saved 40% on storage costs by converting their 15 staging tables from permanent to transient with 0-day retention.


Storage Cost Implications


Both Time Travel and Fail-safe consume storage. The cost depends on how much data changes during the retention window. A table with 10 million rows that gets 100,000 updates per day retains 100,000 rows worth of old micro-partitions per day of retention.


Check your Time Travel storage consumption:

SQL
SELECT table_name,
       active_bytes / (1024*1024*1024) AS active_gb,
       time_travel_bytes / (1024*1024*1024) AS time_travel_gb,
       failsafe_bytes / (1024*1024*1024) AS failsafe_gb
FROM snowflake.account_usage.table_storage_metrics
WHERE table_catalog = 'PRODUCTION_DB'
  AND active_bytes > 0
ORDER BY (time_travel_bytes + failsafe_bytes) DESC
LIMIT 20;

The Zero-Retention Gotcha


A retention period of 0 turns Time Travel off for that object, and once such a table is dropped it cannot be restored with UNDROP. This catches teams that set 0-day retention on staging tables and later need one back, so keep 0-day retention for data you can reload from its source. If the account sets MIN_DATA_RETENTION_TIME_IN_DAYS, the higher of that value and the table's own setting applies, so check both before relying on recovery:

SQL
-- The effective retention is the higher of these two values
SHOW PARAMETERS LIKE 'MIN_DATA_RETENTION_TIME_IN_DAYS' IN ACCOUNT;
SHOW PARAMETERS LIKE 'DATA_RETENTION_TIME_IN_DAYS' IN TABLE production.orders;

Key Takeaways



Frequently Asked Questions

Q: What is the difference between Time Travel and Fail-safe in Snowflake?

Time Travel is user-accessible: you can query, clone, and restore data within the retention window (0-90 days). Fail-safe is an additional 7 days of disaster recovery managed entirely by Snowflake support - you cannot access it directly. It exists for catastrophic recovery only.

Q: How long can I time travel in Snowflake?

Standard Edition supports 0-1 day of Time Travel. Enterprise Edition and above support 0-90 days, set per table, schema, or database using DATA_RETENTION_TIME_IN_DAYS. The default is 1 day for permanent tables.

Q: Does Time Travel cost extra in Snowflake?

Yes. Time Travel retains historical micro-partitions that would otherwise be garbage-collected. The storage cost depends on how much data changes during the retention window. High-churn tables with long retention periods can accumulate significant storage costs.

Q: Can I UNDROP a table after the Time Travel period expires?

No. UNDROP only works within the Time Travel retention window. Once the retention period passes, the table metadata is purged and cannot be recovered by the user. Snowflake Fail-safe may still hold the data for 7 additional days, but only Snowflake support can attempt recovery.

Share this article:
Pranay Vatsal, Founder & CEO

Pranay Vatsal is the Founder & CEO of CelestInfo with deep expertise in Snowflake, data architecture, and building production-grade data systems for global enterprises.

Related Articles

Burning Questions
About CelestInfo

Simple answers to make things clear.

Our AI insights are continuously trained on large datasets and validated by experts to ensure high accuracy.

Absolutely. CelestInfo supports integration with a wide range of industry-standard software and tools.

We implement enterprise-grade encryption, access controls, and regular audits to ensure your data is safe.

Insights are updated in real-time as new data becomes available.

We offer 24/7 support via chat, email, and dedicated account managers.

Still have questions?

Get Assistance

Ready? Let's Talk!

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

Get Assistance