0
0
Snowflakecloud~10 mins

Why Time Travel enables data recovery in Snowflake - Visual Breakdown

Choose your learning style9 modes available
Process Flow - Why Time Travel enables data recovery
Data Modified or Deleted
Time Travel Keeps Snapshots
User Queries Past Data
Snowflake Retrieves Historical Data
Data Recovered or Restored
When data changes or is deleted, Snowflake keeps snapshots. Users can query these snapshots to recover past data.
Execution Sample
Snowflake
SELECT * FROM my_table AT (OFFSET => -3600);
-- Retrieves data from 1 hour ago
This query fetches the state of 'my_table' as it was one hour before the current time.
Process Table
StepActionData StateResult
1Initial data insertedTable has 100 rowsData stored normally
2Delete 20 rowsTable now has 80 rowsRows removed from current view
3Query with Time Travel for 1 hour agoTable snapshot has 100 rowsReturns full 100 rows including deleted ones
4Recover deleted rows by cloning or insertTable restored to 100 rowsData recovered successfully
5Time Travel retention period endsSnapshots expireHistorical data no longer accessible
💡 Time Travel data retention period ends, so older snapshots expire and cannot be queried.
Status Tracker
VariableStartAfter Step 1After Step 2After Step 4Final
Table Row Count010080100100
Time Travel SnapshotsNoneSnapshot at insertSnapshot after deleteSnapshot used for recoverySnapshots expire after retention
Key Moments - 3 Insights
How can deleted data still be queried after deletion?
Because Snowflake keeps snapshots of data changes (see execution_table step 3), Time Travel allows querying past states even after deletion.
What happens when the Time Travel retention period ends?
Snapshots expire and historical data is no longer accessible (see execution_table step 5), so recovery is not possible after that.
Does Time Travel change the current data?
No, Time Travel only keeps historical snapshots; current data reflects the latest state (see execution_table step 2 vs step 3).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, how many rows does the table have immediately after deletion (step 2)?
A100 rows
B80 rows
C20 rows
D0 rows
💡 Hint
Check the 'Data State' column at step 2 in the execution_table.
At which step does Snowflake retrieve historical data using Time Travel?
AStep 3
BStep 2
CStep 1
DStep 5
💡 Hint
Look for when the query uses Time Travel to access past data in the execution_table.
If the Time Travel retention period is extended, what changes in the execution_table?
ASnapshots expire sooner
BCurrent data row count increases
CSnapshots remain accessible longer
DDeleted rows are permanently removed immediately
💡 Hint
Refer to the 'exit_note' and step 5 about snapshot expiration.
Concept Snapshot
Snowflake Time Travel keeps snapshots of data changes.
Users can query past data states using time offsets.
This enables recovery of deleted or changed data.
Snapshots expire after a retention period.
Time Travel does not affect current data state.
Full Transcript
Snowflake's Time Travel feature stores snapshots of data whenever changes happen. When data is deleted or modified, these snapshots keep the previous versions safe. Users can query these snapshots by specifying a time offset, like one hour ago, to see the data as it was then. This allows recovering deleted rows or previous data states without restoring from backups. However, these snapshots only last for a set retention period. After that, the snapshots expire and the historical data is no longer accessible. Time Travel works by keeping historical data separate from the current data, so current queries see the latest state while Time Travel queries can access past states.