Introduction to Time Travel and Fail-Safe in Snowflake

Kajal Raut
3 min readOct 22, 2020

When handling a large amount of data, there is always a chance that we might do something we don’t mean to. Snowflake’s time travel feature comes to the rescue in such cases.

So, what does time travel do?

As the name suggests, using time travel we can travel back in time i.e. it enables access to the data that has been changed or deleted at any point within a defined period of time.

First lets understand what we mean by accessing the changed or deleted data.

Lets say we accidently updated or deleted some data. We will still be able to access the original data using time travel. We can still query the original data, clone it or restore it. In other words, we can say that snowflake preserves the state of the data before modifying it.

The important term in the time travel is the defined period of time — Snowflake preserves the state of the data for a defined period of time called Data Retention Period. It specifies the number of days for which time travel is allowed. The standard data retention period is 1 day, enabled for all snowflake accounts by default i.e. we can query or restore data modified in the last 24 hours. It can have any value up to 90 days based on the snowflake edition. I will soon share a post on snowflake editions.

Now lets see what happens after the data retention or time travel period is over?

Once the data retention period is over, the data is moved to fail-safe.

The purpose of fail-safe is mainly for recovering from catastrophic incidents like storage failure, corruption or security breach. The data is stored for 7 days in the fail-safe mode for snowflake team to recover it. The data in the fail-safe mode is no longer available to the users, only snowflake support team has access to the fail-safe data. This means that we have a window of time travel period to take action on the modified data before we lose it forever.

Now we know about the travel time and fail-safe. Lets see how the data flows in the snowflake.

This flow of data from active to time travel to fail-safe is called snowflake’s Continuous Data Protection Lifecycle.

Thanks for reading 😇

--

--