Module 03 · Lesson 8 of 13Detailed study · about 12 min

Choose how long a table should live

Permanent, temporary and transient tables differ in lifetime and recovery protection. Choose by how the data will be used and whether you can rebuild it.

Understand the idea

Lifetime answers how long an object exists. Recovery protection answers what options remain after a change or deletion. These are different questions. A transient table can exist for years, but it still has less recovery protection than a permanent table.

Key ideas in simple English
ConceptWhat it means
PermanentPersists until dropped; supports Time Travel and Fail-safe.
TemporaryNormally visible only within its creating session; removed when that session ends.
TransientPersists across sessions until dropped, but has no Fail-safe.

A concrete example

Keep the official order history in a permanent table. Use a temporary table for one analyst session and a transient table for rebuildable intermediate data.

Remember: Transient does not mean session-only, and temporary does not mean free.

Explain it step by step · full theory

Understand the idea

Lifetime answers how long an object exists. Recovery protection answers what options remain after a change or deletion. These are different questions. A transient table can exist for years, but it still has less recovery protection than a permanent table.

Time Travel lets you access earlier data within the configured retention window. Temporary and transient tables have limited retention of zero or one day and no Fail-safe. Permanent tables have a separate seven-day Fail-safe period; it is a Snowflake-managed recovery mechanism, not an ordinary queryable backup.

Follow the example

The example creates three empty tables with different lifetimes. Run it in an authorized lab with creation privileges on the SALES schema. The names deliberately differ: a temporary table with the same name as a permanent table can hide that permanent table in the session.

When the session ends, SESSION_TOTALS disappears. REBUILDABLE_TOTALS and DAILY_TOTALS remain. All can use storage while they exist. Choose retention deliberately; do not treat a lower storage bill as a substitute for a recovery plan.

No rows are inserted. In a new session, the temporary table is unavailable; the other two objects remain subject to your role privileges.

Words used in this lesson
Permanent
Persists until dropped; supports Time Travel and Fail-safe.
Temporary
Normally visible only within its creating session; removed when that session ends.
Transient
Persists across sessions until dropped, but has no Fail-safe.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 3

Choose how long a table should live

Northstar sales team
Business requirement

Start with the requirement

Keep the official order history in a permanent table. Use a temporary table for one analyst session and a transient table for rebuildable intermediate data.

Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.

Read the complete diagram explanation
  1. Start with the requirement

    Keep the official order history in a permanent table. Use a temporary table for one analyst session and a transient table for rebuildable intermediate data.

  2. Choose the objects

    Compare the responsibilities: Permanent: Persists until dropped; supports Time Travel and Fail-safe.; Temporary: Normally visible only within its creating session; removed when that session ends.; Transient: Persists across sessions until dropped, but has no Fail-safe.

  3. Explain the outcome

    Transient does not mean session-only, and temporary does not mean free.

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.

Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →

Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Before running this lesson

Examples are for reading first. Optional execution requires an authorized learning account, a selected warehouse for queries, and privileges on the named objects. Nothing runs on this website.

Read the example

SQL · example
CREATE TABLE L2_OBJECTS_LAB.SALES.DAILY_TOTALS (DAY DATE, AMOUNT NUMBER(10,2));
CREATE TEMPORARY TABLE L2_OBJECTS_LAB.SALES.SESSION_TOTALS (AMOUNT NUMBER(10,2));
CREATE TRANSIENT TABLE L2_OBJECTS_LAB.SALES.REBUILDABLE_TOTALS (AMOUNT NUMBER(10,2));

What to expect and why

No rows are inserted. In a new session, the temporary table is unavailable; the other two objects remain subject to your role privileges.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

Which table survives its creating session but has no Fail-safe?

Try it yourself

Choose a table type for the only copy of a finance record and for a staging result that can be regenerated.

Compare your reasoning

Use permanent storage for the finance record with an appropriate retention and recovery plan. Transient can suit the regenerable staging result. Temporary is for session work, not shared durable staging.

Official sources and curriculum

Module 03 · See module scope