Time Travel & Data Recovery
Advancedv1.0.0
Use Snowflake Time Travel to query historical data, recover from accidental changes, compare data across time, and implement audit patterns — all without backup infrastructure.
Content
Overview
Snowflake Time Travel lets you query data as it existed at any point within the retention period (1-90 days). Use it to recover from accidental deletes, compare data across time, and implement audit trails without any backup infrastructure.
Why This Matters
- -Recovery — undo accidental DELETE, TRUNCATE, or DROP operations
- -Auditing — compare data between any two points in time
- -Debugging — see what data looked like when a bug occurred
- -No infrastructure — built into Snowflake, no backup systems needed
How It Works
Step 1: Query Historical Data
Step 2: Recover from Accidental Changes
Step 3: Recover Dropped Tables
Step 4: Compare Data Across Time
Retention Configuration
Best Practices
- -Set DATA_RETENTION_TIME_IN_DAYS to 7-30 for production tables
- -Use transient tables (0 days retention) for staging/temp data to save storage
- -Document the query_id after major operations for easy rollback reference
- -Use CLONE instead of CTAS for recovery (zero-copy, instant)
- -Test recovery procedures before you need them
Common Mistakes
- -Default 1-day retention on critical tables (not enough for weekend incidents)
- -Using permanent tables for staging data (paying for unnecessary time travel storage)
- -Not recording query_id before destructive operations
- -CTAS for recovery instead of CLONE (slow and expensive)
- -Assuming Time Travel works after retention expires (data is gone)
FAQ
Discussion
Loading comments...