Snowflake Time Travel & Fail-safe: Complete Overview
Following are the concepts covered in Snowflake Time Travel:
Table of Contents
What is Snowflake Time Travel?
Snowflake Time Travel is one of the essential features of Snowflake that allows the users to access historical data or data that has been deleted or modified within a defined time period. This feature enables the users to perform the following things in a specified timeline:
- To restore tables, databases, schemas that have been removed or lost.
- To retrieve data from a specific point of time from the past.
- To analyze changes made to a dataset over a period of time.
The Snowflake time travel stores the data for a specific time period. Once the time period is over the data transferred to Snowflake Fail-safe and you no longer have a chance to perform the above actions.
Interested to begin your career in a widely used cloud data warehouse platform?
Know more about the expert’s designed the Snowflake training in Hyderabad.
Time Travel Data Retention Period
The data retention period is a key component of the Time-travel feature. A user may perform various modifications to a table, in such a case Snowflake preserves the state of data before making any updates. And this state of historical data will stay for a specific period of time and this time period is nothing but a Time travel data retention period.
The default data retention period for all Snowflake accounts is 1 day (24 hours). For standard objectives, it is by default 1 day, and for enterprise edition and higher accounts, it is from 0 up to 90 days.
How to Specify the data retention period for Time Travel
Following is the simple steps required to specify the data retention period:
- The users with the ACCOUNTADMIN role can use the DATA_RETENTION_TIME_IN_DAYS object parameter to define the data retention period for your account.
- DATA_RETENTION_TIME_IN_DAYS object parameter is also used to override the default when creating a schema, database, and individual table.
- The users can alter the data retention period for schema, database or table at any time.
You can either extend the data retention time period or decrease it.
Increasing Retention: It extends the retention time for the data available in time travel
Decreasing Retention: It reduces the retention time for the data available in time travel
The process to Enable and Disabling Time Travel
There are no tasks actually required to enable Time Travel. By default, it is enabled for 1 day for standard editions. To have a longer data retention period of 90 days for schemas, databases, and tables. The extended retention demands additional storage resources and reflected in monthly storage charges.
The Time Travel disablement is not possible for an account but it can be possible for individual schemas, databases, and tables by specifying. DATA_RETENTION_TIME_IN_DAYS with a value of 0 for the object.
What is Fail-Safe?
Fail-safe is a core feature in Snowflake and offers a default 7-day period in which the historical data can be recoverable by Snowflake. The fail-safe default period starts right after the Time Travel retention ends.
Time Travel feature in Snowflake acts as a great medium to store the past data that was intentionally deleted or accidentally lost. Fail-safe provides free 7 days storage and starts functioning right after the time-travel period ends. Hope this Snowflake & time-travel blog has helped you in finding some useful information. You can also check out our frequently asked Snowflake interview questions and Snowflake tutorial here.