Introduction to Time Travel

Snowflake allows accessing historical data of a point in the past that may have been modified or deleted at the current time. Using time travel functionality a number of situations can be handled. For example, there can be accidental updates on data that we would want to revert. So using time travel, we can recover and query data before the update ran on that data. Similarly, if we accidentally drop the table, we can easily un-drop that table and return to the previous state. Also, from an analysis perspective, we can perform queries on a table over a particular period of time using the time travel functionality.

Using time travel we can perform the following functionalities with extreme ease:

a. We can query data from the past that has been changed or deleted.

b. We can restore databases, tables & schemas that may have been dropped.

c. We can also clone databases, tables & schemas of a specific time. This feature basically combines cloning and time travel together.

How does Snowflake perform Time Travel?

Snowflake saves the state of the data before making an update to the data. This is done by Snowflake internally and it is not visible to the user. But the duration from which the state of the data is saved is driven by the retention period.

The retention period may vary between 0 to 90 days. By default, the retention period is set to 1 day but that can be configured. We can configure it separately for each database, table & schema.

#analytics #aws #big data and fast data #cloud #database #ml # ai and data engineering #sql #tech blogs #snowflake #time travel

KSnow: Time Travel and Fail-safe in Snowflake
5.20 GEEK