CertSafari
    Snowflake SnowPro Advanced: Administrator (ADA-C02)· Lessons

    Domain 6 · Lesson 24/24

    Snowflake Time Travel and Fail-safe

    Given a scenario, manage Snowflake Time Travel and Fail-safe.

    20 min read
    4.5% of exam
    8 sources
    Published 20 Oct 2026
    Docs as of 18 Oct 2026

    What you will be able to do

    • Set and inherit DATA_RETENTION_TIME_IN_DAYS within the limits of each edition and table type
    • Explain how MIN_DATA_RETENTION_TIME_IN_DAYS changes effective retention, and how to turn Time Travel off for an object
    • Query historical data with AT and BEFORE using TIMESTAMP, OFFSET and STATEMENT, and diagnose a failing query
    • Clone an object as of a past point and restore dropped objects with UNDROP
    • Say what Fail-safe protects, who can recover from it, and which tables have it

    Key concept

    Data retention period — The number of days Snowflake keeps the earlier state of data after each change or drop. Inside that window you can query, clone and undrop the old state. After it ends, the data moves to Fail-safe, and only Snowflake can reach it there.

    1.Retention periods and edition limits

    Time Travel lets you read, clone and restore data as it was before it changed, and the data retention period decides how far back you can go. When a row is updated or deleted, or a table is dropped, Snowflake keeps the earlier state for the number of days set in DATA_RETENTION_TIME_IN_DAYS. The clock starts at the change, not when the table was created. Take a table with 1-day retention and a row updated on Day 5 at 1:00 PM: you can query that row's old version until Day 6 at 1:00 PM. Each later change gets its own window.

    Your edition sets the upper limit. Every account starts with 1 day. On Standard Edition the only values allowed are 0 and 1 day, and that applies at every level: account, database, schema and table. Enterprise Edition and higher let permanent databases, schemas and tables use any value from 0 to 90 days. So on a Standard account, setting a table or the account to 14 days fails. The only route to 14 days is upgrading to Enterprise and running the same ALTER statement again. Longer retention also costs money, because the extra history is billed as storage.

    The table type also caps retention, whatever the edition. Permanent, transient and temporary tables have different lifecycles. For Time Travel, the point is that transient and temporary tables allow only 0 or 1 day, even on Enterprise, and neither has a Fail-safe period. A temporary table's window also ends as soon as the table is dropped or its session ends. A transient table lasts until someone drops it, just like a permanent one.

    Time Travel and Fail-safe days by table type and edition
    Table typeTime Travel, Standard EditionTime Travel, Enterprise EditionFail-safeTotal history kept (min, max days)
    Permanent0 or 10 to 9077–8 on Standard, 7–97 on Enterprise
    Transient0 or 10 or 100–1
    Temporary0 or 1, ends when the session ends0 or 1, ends when the session ends00–1

    MIN_DATA_RETENTION_TIME_IN_DAYS sets a floor; it does not raise the limit. An ACCOUNTADMIN sets it on the account. It leaves each object's own DATA_RETENTION_TIME_IN_DAYS value as it is, but the retention that actually applies becomes MAX(DATA_RETENTION_TIME_IN_DAYS, MIN_DATA_RETENTION_TIME_IN_DAYS). Because it works only through that MAX, it stops retention from being set too low. It is not a way past Standard Edition's 1-day limit.

    Retention passes down the hierarchy. The ACCOUNTADMIN sets the account default. A value set on a database or schema is inherited by the objects created inside it. Any object can override that with its own value, either when it is created or later. Changing a parent changes every child that has no explicit value of its own, which is why setting the account to 0 is not recommended. A change also affects data already in Time Travel. Raising a table from 10 to 20 days keeps its current Time Travel data for the longer period. Lowering it moves any history that falls outside the new window into Fail-safe.

    Checkpoint 1 of 9· Match them up

    Match each table type and edition to the history Snowflake can keep for it

    Tap a term, then the definition that fits it.

    Checkpoint 2 of 9· Exam question

    A company on Standard Edition must keep 14 days of Time Travel history on its production ORDERS table for an audit. An administrator runs ALTER TABLE orders SET DATA_RETENTION_TIME_IN_DAYS = 14; and the statement fails. What is the MOST appropriate way to meet the requirement?

    Checkpoint 3 of 9· Exam question

    A team on Enterprise Edition reloads a 4 TB staging table from source files every night and has never needed to recover it. To reduce storage cost they re-create it as a TRANSIENT table. Select TWO statements that correctly describe the effect of this change.(Select 2)

    0 of 2 selected

    Sources1234

    2.Turning Time Travel on and off, and checking it

    You don't need to switch anything on. Time Travel is active from the start with 1-day retention, and it cannot be turned off for a whole account. If an ACCOUNTADMIN sets DATA_RETENTION_TIME_IN_DAYS to 0 at the account level, that only changes the default that new databases, schemas and tables inherit. Any of them can still set its own value at any time.

    For a single object, a retention of 0 turns Time Travel off, unless the account has a MIN_DATA_RETENTION_TIME_IN_DAYS above 0. In that case the higher value wins. When retention really is 0, a dropped object cannot be restored. Changed data in a permanent table goes straight to Fail-safe, while in a transient table it is deleted. A background process does this, so TIME_TRAVEL_BYTES can briefly show a non-zero value. As a rule, keep at least 1 day on anything you might need to recover.

    Changing an existing table's retention periodsql
    ALTER TABLE mytable SET DATA_RETENTION_TIME_IN_DAYS=30;

    To see an object's retention, read the retention_time column from SHOW TABLES, SHOW SCHEMAS or SHOW DATABASES. A value of 0 means Time Travel is off. Add HISTORY to include objects that have already been dropped. For streams, check the stale_after column of SHOW STREAMS. For derived objects such as materialized views, check the parent object's retention.

    Listing databases, including dropped ones, with their retention_time and dropped_on columnssql
    SHOW DATABASES HISTORY;

    Checkpoint 4 of 9· Check yourself

    An ACCOUNTADMIN runs ALTER ACCOUNT SET DATA_RETENTION_TIME_IN_DAYS = 0 on an Enterprise Edition account. Which statement about the result is correct?

    Sources1

    3.Querying historical data with AT and BEFORE

    The AT or BEFORE clause goes in the FROM clause, right after the table name. It names the point in the past to read from, and one of these parameters sets that point:

    AT | BEFORE parameters
    ParameterPoints toWatch for
    TIMESTAMP => <timestamp>An exact date and timeA string with no cast is treated as UTC (TIMESTAMP_NTZ); resolution is milliseconds
    OFFSET => <time_difference>Seconds before now, written -N-120 is two minutes; -30*60 is thirty minutes
    STATEMENT => <id>The query ID of a DML, TCL or SELECT statementThe query must have run within the last 14 days, otherwise you get statement not found
    STREAM => '<name>'A stream's current offsetWorks only in CREATE STREAM or with the CHANGES clause

    OFFSET is in seconds, never minutes. -3600 goes back one hour, while -30 goes back half a minute and will almost certainly still show a mistake made earlier. You can write arithmetic directly, such as -60*30 for thirty minutes, and the value must be a constant expression.

    AT and BEFORE differ only at the boundary. AT includes changes made by a statement whose timestamp equals the given point. BEFORE reads the state just before the identified statement completes, which makes BEFORE(STATEMENT => ...) the usual way to see a table before a particular DELETE. Because that point is when the statement finishes, not when it starts, rows committed by other sessions while it ran are included. If you need to exclude them, use a TIMESTAMP just before the statement started. Switching AT to BEFORE does nothing to fix an OFFSET in the wrong units.

    Timestamps cause most of the surprises. A string with no cast is read as UTC. In one session set to America/Los_Angeles, a value cast with ::TIMESTAMP was also read as UTC. The query below therefore asked for a moment before the table existed and failed with error 000707. Casting the same value to TIMESTAMP_LTZ read it as local time and returned the expected rows.

    Fails: ::TIMESTAMP is read as UTC, so the time falls before the table was createdsql
    SELECT * FROM tt1 at(TIMESTAMP => '2024-06-05 15:29:00'::TIMESTAMP);
    Works: TIMESTAMP_LTZ reads the value in the session's local time zonesql
    SELECT * FROM tt1 at(TIMESTAMP => '2024-06-05 15:29:00'::TIMESTAMP_LTZ);

    A Time Travel query fails in three cases. The point may be outside the retention period. It may be inside the period but have no history behind it, because the retention was only recently extended and older history had already been moved out. Or it may be at or before the moment the object was created. A query for a date seven weeks back on an Enterprise account can therefore fail even with retention set to 90 days, if that 90 was set only last week.

    Historical results use the table's current definition: a column added yesterday shows up in a query for last week. Historical data needs the same privileges as current data. You cannot apply AT or BEFORE to a CTE's name, but you can use them inside the CTE's own query. Hybrid tables accept only AT(TIMESTAMP => ...); OFFSET, STATEMENT, STREAM and BEFORE are not supported for them.

    Checkpoint 5 of 9· Fill the gap

    Your session's time zone is America/Los_Angeles. Table tt1 was created at 15:25 local time, and you want its rows as they were at 15:29 local time. Which cast completes the query so that Snowflake reads the timestamp in your local time zone instead of UTC?

    SELECT * FROM tt1 at(TIMESTAMP => '2024-06-05 15:29:00':: ? );

    Checkpoint 6 of 9· Exam question

    An analyst needs the ORDERS table as it looked 30 minutes ago, before a faulty update. The query SELECT * FROM orders AT(OFFSET => -30); still returns rows that include the faulty update. What explains this and how should the query be fixed?

    Sources5

    4.Cloning an object as it was

    CREATE … CLONE accepts the same clause, placed right after the source object's name. That lets you create a copy of a table, schema or database as it was at a past point, next to the damaged current version, and compare the two. Zero-copy cloning otherwise behaves as usual. Without AT or BEFORE, the clone reflects the object as it is now.

    Cloning schema S1 as of a past timestampsql
    CREATE SCHEMA S2 CLONE S1 AT(TIMESTAMP => '2025-04-01 12:00:00');

    A point-in-time clone leaves some contents out. External tables and internal stages are not cloned. User tasks are also skipped: the S2 clone above gets none of S1's tasks, while a plain clone of S1 would include them. Hybrid tables are cloned with a database but not with a schema. A database or schema clone that uses STATEMENT fails if any hybrid tables exist, and it succeeds only if you add IGNORE HYBRID TABLES, which skips them.

    Clones follow the same retention rules as queries. Once the retention period for the requested point has passed, that past version can no longer be cloned. A schema with 7 days of retention can be cloned as of yesterday afternoon, but not as of last month.

    Checkpoint 7 of 9· Check yourself

    Schema S1 holds several permanent tables and a user task T1. You run CREATE SCHEMA S2 CLONE S1 AT(TIMESTAMP => '2025-04-01 12:00:00'), then CREATE SCHEMA S3 CLONE S1. Which describes the result?

    Sources51

    5.Restoring dropped objects with UNDROP

    UNDROP restores the most recent version of a dropped object, as long as it was dropped within its retention period. It works for tables, schemas and databases, and also for objects such as dynamic tables, Iceberg tables, tags, external volumes and accounts.

    Restoring the most recently dropped table named t2sql
    UNDROP TABLE t2;

    A restored table always goes back to its original database and schema. The name must be free: if a table with that name already exists, for example a replacement someone created after the drop, UNDROP returns an error. When the same name has been dropped several times, UNDROP by name brings back only the most recent one. To restore an older one, find its table_id in SNOWFLAKE.ACCOUNT_USAGE.TABLES (or database_id in DATABASES) and pass it to IDENTIFIER(). The object comes back under its original name.

    Restoring a specific earlier drop by its system-generated IDsql
    UNDROP TABLE IDENTIFIER(408578);

    Dropping a container changes whose retention counts. When a database is dropped, child schemas and tables lose any different retention they had set explicitly, and are kept only as long as the database itself. Child tables of a dropped schema are handled the same way. So a database with 10 days set explicitly can still be undropped six days after the drop, with its children. A child table set to 30 days inside a 1-day database cannot rely on its own setting once the whole database is gone.

    Hybrid tables are the exception: a dropped hybrid table cannot be undropped, and undropping a database does not bring back the hybrid tables it contained.

    Checkpoint 8 of 9· Fill the gap

    Table my_table in DB1.S1 has been dropped twice. You want the older of the two drops back, and SNOWFLAKE.ACCOUNT_USAGE.TABLES shows its table_id as 408578. Running UNDROP TABLE my_table would only restore the most recent drop. Which keyword completes the statement so that it restores the older drop?

    UNDROP TABLE  ? (408578);

    Sources617

    6.Fail-safe after Time Travel ends

    Fail-safe is separate from Time Travel. It is a fixed 7-day period, which you cannot configure, that starts as soon as the Time Travel window ends. During it, Snowflake may be able to recover data lost to a system failure or another extreme event such as a security breach. It is not a way for you to reach old data: there is no AT clause, no UNDROP and no query against it.

    Recovering from Fail-safe means opening a case with Snowflake Support. Recovery is best-effort and meant only for when every other recovery option has failed. It can take from several hours to several days, and it runs on Snowflake-managed serverless compute, billed under the FAILSAFE_RECOVERY service type.

    Only permanent tables have Fail-safe. A permanent table on Standard Edition therefore keeps 7 to 8 days of history in total, and up to 97 days on Enterprise with 90-day retention. Transient and temporary tables keep at most 1 day and nothing after it. That is the trade-off when choosing a table type. A 4 TB staging table reloaded from files every night loses nothing by being transient, because the source can rebuild it, and it stops paying Fail-safe storage on every reload's churn. A long-lived fact table should stay permanent.

    Storage is charged for each day of history in both phases, so Fail-safe costs money even if you never use it. An ACCOUNTADMIN can see Fail-safe storage in Snowsight on the Consumption page by filtering to the Storage usage type. Also note that a long-running Time Travel query holds data back from moving into Fail-safe until the query finishes.

    Checkpoint 9 of 9· Check yourself

    On an Enterprise Edition account, two tables with 1-day retention were dropped three days ago: SALES_FACT, a permanent table, and STG_LOAD, a transient table. Neither can be undropped any more. What recovery options remain?

    Sources831

    Practise it for real

    Set a retention period on a test table, confirm it, read past data, then drop and restore the table.

    1. 1.On an Enterprise Edition account, create a small permanent test table named mytable and run ALTER TABLE mytable SET DATA_RETENTION_TIME_IN_DAYS=30;.

      Why: Retention above 1 day is allowed only for permanent objects on Enterprise Edition or higher.

      You should see: The statement succeeds. On a Standard Edition account the same statement fails for any value above 1.

    2. 2.Run SHOW TABLES and find the retention_time column for MYTABLE.

      Why: The SHOW output tells you the retention an object actually has.

      You should see: retention_time shows 30.

    3. 3.Delete a few rows, then within five minutes run SELECT * FROM mytable AT(OFFSET => -60*5);.

      Why: OFFSET is in seconds, so -60*5 reads the table as it was five minutes ago.

      You should see: The deleted rows appear. If the table was created less than five minutes ago, the query fails because that point is before the table existed.

    4. 4.Run DROP TABLE mytable;, then UNDROP TABLE mytable;, then SHOW TABLES HISTORY.

      Why: UNDROP restores the most recent dropped version, and only within its retention period.

      You should see: A status saying the table was successfully restored, and MYTABLE listed with no dropped_on value.

    Stuck? Get a nudge

    If a TIMESTAMP query fails with error 000707 when the time looks right, cast the value to TIMESTAMP_LTZ.

    Sources

    (8)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “For permanent databases, schemas, and tables, the retention period can be set to any value from 0 up to 90 days.”
      ↩︎ Retention periods and edition limits
      “For Snowflake Standard Edition, the retention period can be set to 0 (or unset back to the default of 1 day)”
      ↩︎ Retention periods and edition limits
      “extended data retention requires additional storage which will be reflected in your monthly storage charges.”
      ↩︎ Retention periods and edition limits
      “the effective minimum data retention period for an object is determined by MAX(DATA_RETENTION_TIME_IN_DAYS, MIN_DATA_RETENTION_TIME_IN_DAYS)”
      ↩︎ Retention periods and edition limits
      “If a retention period is specified for a database or schema, the period is inherited by default for all objects created in the database/schema.”
      ↩︎ Retention periods and edition limits
      “we do not recommend changing the retention period to 0 at the account level.”
      ↩︎ Retention periods and edition limits
      “Causes the data currently in Time Travel to be retained for the longer time period.”
      ↩︎ Retention periods and edition limits
      “If the data is outside the new period, it moves into Fail-safe.”
      ↩︎ Retention periods and edition limits
      “Time Travel cannot be deactivated for an account.”
      ↩︎ Turning Time Travel on and off, and checking it
      “When an object with no retention period is dropped, you will not be able to restore the object.”
      ↩︎ Turning Time Travel on and off, and checking it
      “any modified or deleted data is moved into Fail-safe (for permanent tables) or deleted (for transient tables) by a background process.”
      ↩︎ Turning Time Travel on and off, and checking it
      “To include information about objects that have already been dropped, include the HISTORY clause with the SHOW command.”
      ↩︎ Turning Time Travel on and off, and checking it
      “Hybrid tables can be cloned for databases but not for schemas.”
      ↩︎ Cloning an object as it was
      “Past objects can no longer be cloned.”
      ↩︎ Cloning an object as it was
      “The child schemas or tables are retained for the same period of time as the database.”
      ↩︎ Restoring dropped objects with UNDROP
      “A long-running Time Travel query will delay moving any data and objects”
      ↩︎ Fail-safe after Time Travel ends
      “End of Time Travel = time of the change + data retention period”
      ↩︎ Key concept
      “For Snowflake Standard Edition, the retention period can be set to 0 (or unset back to the default of 1 day)”
      ↩︎ Exam trap 1
      “Time Travel cannot be deactivated for an account.”
      ↩︎ Exam trap 2
      “the higher value setting takes precedence”
      ↩︎ Prediction
      “this default can be overridden at any time for any database, schema, or table.”
      ↩︎ Checkpoint
      “User tasks in a database or schema are not cloned when using CREATE SCHEMA … TIMESTAMP.”
      ↩︎ Checkpoint
    2. 2.
      “Extended Time Travel (up to 90 days) requires Snowflake Enterprise Edition.”
      ↩︎ Retention periods and edition limits
    3. 3.
      “Transient and temporary tables have no Fail-safe period.”
      ↩︎ Retention periods and edition limits
      “Long-lived tables, such as fact tables, should always be defined as permanent to ensure they are fully protected by Fail-safe.”
      ↩︎ Fail-safe after Time Travel ends
      “Storage fees are incurred for maintaining historical data during both the Time Travel and Fail-safe periods.”
      ↩︎ Fail-safe after Time Travel ends
      “Historical data in transient tables can’t be recovered by Snowflake after the Time Travel retention period ends.”
      ↩︎ Checkpoint
    4. 4.
      “Transient tables exist until explicitly dropped and are available to all users with appropriate privileges.”
      ↩︎ Retention periods and edition limits
    5. 5.
      “Specifies the difference in seconds from the current time to use for Time Travel, in the form -N”
      ↩︎ Querying historical data with AT and BEFORE
      “the request is inclusive of any changes made by a statement or transaction with a timestamp equal to the specified parameter”
      ↩︎ Querying historical data with AT and BEFORE
      “This point in time is just before the statement, identified by its query ID, is completed.”
      ↩︎ Querying historical data with AT and BEFORE
      “The query ID must reference a query that has been executed within the last 14 days.”
      ↩︎ Querying historical data with AT and BEFORE
      “If no explicit cast is specified, the timestamp in the AT clause is treated as a timestamp with the UTC time zone”
      ↩︎ Querying historical data with AT and BEFORE
      “no historical data is available (e.g. if the retention period was extended), the statement fails.”
      ↩︎ Querying historical data with AT and BEFORE
      “When you access historical table data, the results include the columns, default values, etc. from the current definition of the table.”
      ↩︎ Querying historical data with AT and BEFORE
      “Historical data has the same access control requirements as current data.”
      ↩︎ Querying historical data with AT and BEFORE
      “the clone defaults to the state of the object as of now (the CURRENT_TIMESTAMP value)”
      ↩︎ Cloning an object as it was
      “The error prompts you to run the command using the IGNORE HYBRID TABLES parameter.”
      ↩︎ Cloning an object as it was
      “Specifies the difference in seconds from the current time to use for Time Travel, in the form -N”
      ↩︎ Exam trap 3
    6. 6.
      “An object can be restored only if the object was deleted within the Data retention period.”
      ↩︎ Restoring dropped objects with UNDROP
      “If a table with the same name already exists, an error is returned.”
      ↩︎ Restoring dropped objects with UNDROP
      “you can use the IDENTIFIER keyword with the system-generated identifier (from the TABLES view) to specify which table to restore.”
      ↩︎ Restoring dropped objects with UNDROP
      “You cannot undrop a hybrid table.”
      ↩︎ Restoring dropped objects with UNDROP
      “Tables can only be restored to the database and schema that contained the table at the time of deletion.”
      ↩︎ Exam trap 4
      “Tables can only be restored to the database and schema that contained the table at the time of deletion.”
      ↩︎ Prediction
    7. 7.
      “Hybrid tables that belong to the specified database are not undropped.”
      ↩︎ Restoring dropped objects with UNDROP
    8. 8.
      “Fail-safe provides a (non-configurable) 7-day period during which historical data may be recoverable by Snowflake.”
      ↩︎ Fail-safe after Time Travel ends
      “This period starts immediately after the Time Travel retention period ends.”
      ↩︎ Fail-safe after Time Travel ends
      “To recover data from Fail-safe, open a case with Snowflake Support.”
      ↩︎ Fail-safe after Time Travel ends
      “Data recovery through Fail-safe may take from several hours to several days to complete.”
      ↩︎ Fail-safe after Time Travel ends
      “Data recovery through Fail-safe uses Snowflake-managed serverless compute.”
      ↩︎ Fail-safe after Time Travel ends
      “Fail-safe is not provided as a means for accessing historical data after the Time Travel retention period has ended.”
      ↩︎ Exam trap 5

    Ready to test yourself?

    Practise the 16 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.