What you will be able to do
- Choose between permanent, transient and temporary tables based on how long they live and their Time Travel and Fail-safe protection
- Avoid the trap where a temporary table hides a permanent table with the same name
- Contrast Apache Iceberg tables and read-only external tables for data held outside Snowflake-managed storage
- Pick a standard, secure or materialized view, and tell a materialized view apart from a dynamic table
1.Permanent, transient and temporary tables
Snowflake's native table types differ in how long a table lives and how much of its data can be recovered after it is changed or dropped. Permanent is the default. A permanent table lasts until someone drops it, gets Time Travel, and gets a further 7 days of Fail-safe. Transient and temporary tables give up Fail-safe and the storage cost that comes with it, so they suit data that is only needed for a while. For recovery mechanics, see Time Travel and Fail-safe. The Fail-safe period cannot be changed for any table type.
| Type | Persistence | Time Travel retention (days) | Fail-safe (days) |
|---|---|---|---|
| Temporary | Remainder of session | 0 or 1 (default is 1) | 0 |
| Transient | Until explicitly dropped | 0 or 1 (default is 1) | 0 |
| Permanent (Standard Edition) | Until explicitly dropped | 0 or 1 (default is 1) | 7 |
| Permanent (Enterprise Edition and higher) | Until explicitly dropped | 0 to 90 (default is configurable) | 7 |
A temporary table exists only in the session that created it, and other users and sessions cannot see it. When the session ends, its data is purged, and neither you nor Snowflake can recover it. Its Time Travel therefore lasts 24 hours or until the session ends, whichever comes first. You pay for its storage while it exists, so drop large temporary tables explicitly rather than leaving them in sessions that stay open longer than a day. Creating one does not need the CREATE TABLE privilege on the schema. A stored procedure can also create a procedure-scoped temporary table that lasts for a single execution.
CREATE TEMPORARY TABLE mytemptable (id NUMBER, creation_date DATE);A transient table lasts until it is dropped and is visible to any user with the right privileges, just like a permanent table, but it has no Fail-safe and so no Fail-safe cost. Once its Time Travel retention has passed, its data cannot be recovered by you or by Snowflake. Use it for large staging or intermediate tables whose data you can rebuild. Creating a schema or database as transient makes every table inside it transient. Neither transient nor temporary tables can be converted to another table type after they are created.
The hiding works in both directions. If you create a permanent table with the same name as an existing temporary table, the new table is hidden for the rest of that session. This matters most for DDL. In that session, a DROP followed by a Time Travel restore, or a CREATE OR REPLACE, acts on the temporary table, not on the permanent one you meant.
Checkpoint 1 of 5· Match them up
Match each native table type to how long it lasts and how much of its data can be recovered
Tap a term, then the definition that fits it.
Transient tables last like permanent tables but have no Fail-safe, so Snowflake cannot recover them after Time Travel ends. Temporary tables also have no Fail-safe and only last for the session. Only permanent tables get the 7-day Fail-safe period.
“Transient tables are similar to permanent tables with the key difference that they do not have a Fail-safe period.”Source: docs.snowflake.com
Checkpoint 2 of 5· Check yourself
In your session you create a temporary table named STAGING. Later in the same session you run CREATE TABLE staging to make a permanent table with the same name in the same schema, then run DROP TABLE staging. Which table is dropped?
For the rest of the session, the temporary table takes priority over any other table with the same name. A permanent table created after it stays hidden, so the DROP removes the temporary table.
“the newly-created table is hidden by the temporary table.”Source: docs.snowflake.com
Sources1
2.Iceberg tables and external tables: data outside Snowflake-managed storage
Two table types let Snowflake query data that sits in cloud storage you control rather than in Snowflake's own storage. They differ in what you can do with that data.
An external table queries files in an external stage as if they were a table. Snowflake does not store or manage that stage. External tables are read-only: you can query them, join them and build views on them, but you cannot run DML against them. Every external table has a VALUE column of type VARIANT that holds one row of the file, plus the METADATA$FILENAME and METADATA$FILE_ROW_NUMBER pseudocolumns. To create one you need to know the file format and record format, but not the schema. Queries can be slower than on native tables. Building a materialized view on the external table can speed them up, and for Parquet files Iceberg tables are the recommended choice for best performance.
An Apache Iceberg table combines the performance and query semantics of a normal Snowflake table with cloud storage that you manage. It is the right choice for an existing data lake that you cannot or do not want to move into Snowflake. Iceberg is an open table format that provides ACID transactions, schema evolution, hidden partitioning and table snapshots over Parquet data files. Storage comes in two forms:
- Snowflake storage (
EXTERNAL_VOLUME = SNOWFLAKE_MANAGED): Snowflake stores and manages the files, bills you for the storage, and protects permanent tables with Fail-safe. - External volume storage: the files sit in Amazon S3, Google Cloud Storage or Azure Storage that you manage. You are responsible for protecting and recovering the data, there is no Fail-safe, and your cloud provider bills you for storage.
- Either way, an external volume is the named, account-level object that holds the IAM entity Snowflake uses to reach customer-managed storage.
The catalog decides who manages the table's metadata. You can use Snowflake as the Iceberg catalog, which makes the table Snowflake-managed. Or you can create a catalog integration that connects Snowflake to an external catalog, for example when AWS Glue manages the table. A Snowflake-managed Iceberg table can also be synced to Snowflake Open Catalog so that third-party compute engines can query it. That openness is what sets Iceberg apart from a native table, whose files only Snowflake reads, and from an external table, which Snowflake can only read.
| Aspect | Native permanent table | Iceberg table | External table |
|---|---|---|---|
| Where the files live | Snowflake-managed storage | Snowflake storage or an external volume you manage | External stage that Snowflake does not manage |
| DML | Yes | ACID transactions | No: read-only |
| Format | Snowflake micro-partitions | Apache Iceberg over Parquet | Any COPY INTO format except XML |
| Fail-safe | 7 days | Only on Snowflake storage | Not applicable |
Checkpoint 3 of 5· Check yourself
A data engineer defines an external table over CSV files in an external stage. Some rows contain bad values, so they run UPDATE against the external table to fix them. What happens?
External tables only let you read the files in the stage. You can query them, join them and build views on them, but DML such as UPDATE is not allowed. A materialized view can make queries faster, but it does not make the table writable.
“External tables are read-only. You can’t perform data manipulation language (DML) operations on external tables.”Source: docs.snowflake.com
3.Standard, secure and materialized views
A standard view is a stored query that you can query like a table. It can join two or more tables or views, it uses no storage, and it computes its result each time it is queried. By default, its definition is visible to other users in various commands and interfaces. Use a standard view when you want to reuse logic without precomputing anything, for example a three-table join over data that changes constantly.
A secure view is created by adding the SECURE keyword to CREATE VIEW or CREATE MATERIALIZED VIEW. You can switch an existing view either way with ALTER VIEW. Only users granted the role that owns a secure view can see its definition. Other users do not see it in SHOW VIEWS, GET_DDL or the Information Schema VIEWS view, and its internals are hidden in Query Profile, even from the owner. More importantly, Snowflake turns off the optimizations that could let a user infer rows the view filters out. Here is how that leak would work against a view that only shows a user their red widgets:
SELECT *
FROM widgets_view
WHERE 1/iff(color = 'Purple', 0, 1) = 1;With a standard view, the optimizer may reorder the WHERE predicates and evaluate the user's predicate first. A secure view always applies its own WHERE clause first, so the error never happens. Giving up those optimizations is why secure views can run more slowly than non-secure views. Use them for data privacy, such as views shared with other accounts or views over sensitive rows, and not for views that only make queries easier to write.
A materialized view stores a precomputed result, so querying it is faster than running its query against the base table. That speed costs money in two ways. The stored results add to storage. And whenever the base table changes, a background service that runs on Snowflake-provided compute updates every materialized view on that table, billed in 1-second increments. Maintenance cost rises with the number of materialized views and the amount of data that changes. Clustering a materialized view differently from its base table can multiply the work. Suspending a materialized view only defers maintenance cost, it does not reduce it. Changing or dropping an existing column in the base table suspends its materialized views, and you have to recreate them.
Materialized views fit expensive aggregation, projection or selection queries that run often over large tables that change little, such as a dashboard that runs the same aggregation hundreds of times a day over a 500 GB table updated a few times daily. They are always up to date, and the optimizer can rewrite queries to use the precomputed result automatically.
| View type | Stores results? | Main cost | Use when |
|---|---|---|---|
| Standard | No: consumes no storage | Compute on every query | Reusable logic, joins, constantly changing data |
| Secure | No (or yes, if it is a secure materialized view) | Lost optimizer shortcuts, so possibly slower | The definition or filtered-out rows must stay hidden |
| Materialized | Yes: precomputed and always up to date | Storage plus background maintenance compute | Frequent, expensive queries over one slowly changing table |
Checkpoint 4 of 5· Check yourself
Analysts run the same expensive aggregation dozens of times a day over an external table that points at files in an external stage, and every run is slow. Which view built on that external table would make these queries faster?
A materialized view stores a precomputed result, so the slow scan of the external files does not have to run again on every query. A standard view recomputes its result each time it is queried. A secure view turns off some optimizations and can be slower. External tables are read-only, but you can still build views on them.
“To improve query performance, you can use a materialized view based on an external table.”Source: docs.snowflake.com
4.Where dynamic tables fit next to materialized views
Dynamic tables store the result of a query and refresh it automatically to meet a target lag that you set. Like materialized views, they consume storage and use compute to stay up to date, so the choice between them comes down to two questions.
First, how many tables does the query read? A materialized view can query only one table. A dynamic table can join and aggregate across tables and can feed multi-step pipelines. Second, how fresh must the data be? A materialized view is always current, and the optimizer can rewrite queries to use it automatically. A dynamic table is only as fresh as its target lag, and the minimum lag is one minute. Choose a materialized view to speed up queries on one table. Choose a dynamic table when the result combines several tables and some lag is acceptable.
| Requirement | Dynamic tables | Materialized views |
|---|---|---|
| SQL pipeline with joins or aggregations | Preferred | No (single table only) |
| Single-table query acceleration | Possible | Preferred |
| Always-current data with no lag | No (minimum TARGET_LAG setting is 1 minute) | Preferred |
| Optimizer rewrites queries to use the precomputed result | No | Preferred |
Checkpoint 5 of 5· Check yourself
A team wants a precomputed daily-revenue result that joins an orders table to a customers table and aggregates by region. Data up to five minutes old is fine, and nobody wants to write orchestration code. What should they build?
The result combines two tables and tolerates some lag, which is the dynamic table case. A materialized view can read only a single base table. A standard or secure view would recompute the join on every query instead of storing the result.
“Materialized views accelerate repeated queries against a single base table.”Source: docs.snowflake.com
Sources
(7)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“The Fail-safe period is not configurable for any table type.”
↩︎ Permanent, transient and temporary tables“When the session ends, data in the table is purged and is not recoverable”
↩︎ Permanent, transient and temporary tables“creating a temporary table does not require the CREATE TABLE privilege on the schema in which the object is created.”
↩︎ Permanent, transient and temporary tables“Transient tables are similar to permanent tables with the key difference that they do not have a Fail-safe period.”
↩︎ Permanent, transient and temporary tables“All tables created in a transient schema, as well as all schemas created in a transient database, are transient by definition.”
↩︎ Permanent, transient and temporary tables“the temporary table takes precedence in the session over any other table with the same name in the same schema.”
↩︎ Permanent, transient and temporary tables“the temporary table takes precedence in the session over any other table with the same name in the same schema.”
↩︎ Exam trap 1“Transient tables are similar to permanent tables with the key difference that they do not have a Fail-safe period.”
↩︎ Exam trap 2“the newly-created table is hidden by the temporary table.”
↩︎ Checkpoint - 2.
“External tables are read-only.”
↩︎ Iceberg tables and external tables: data outside Snowflake-managed storage“A VARIANT type column that represents a single row in the external file.”
↩︎ Iceberg tables and external tables: data outside Snowflake-managed storage“To create external tables, you are only required to have some knowledge of the file format and record format of the source data files.”
↩︎ Iceberg tables and external tables: data outside Snowflake-managed storage“you can use a materialized view based on an external table.”
↩︎ Iceberg tables and external tables: data outside Snowflake-managed storage“External tables are read-only.”
↩︎ Exam trap 3“External tables are read-only. You can’t perform data manipulation language (DML) operations on external tables.”
↩︎ Checkpoint“To improve query performance, you can use a materialized view based on an external table.”
↩︎ Checkpoint - 3.
“They are ideal for existing data lakes that you cannot, or choose not to, store in Snowflake.”
↩︎ Iceberg tables and external tables: data outside Snowflake-managed storage“ACID (atomicity, consistency, isolation, durability) transactions”
↩︎ Iceberg tables and external tables: data outside Snowflake-managed storage“Snowflake storage (EXTERNAL_VOLUME = SNOWFLAKE_MANAGED): Snowflake stores and manages the files for you.”
↩︎ Iceberg tables and external tables: data outside Snowflake-managed storage“An external volume is a named, account-level Snowflake object that you use to connect Snowflake to your external cloud storage for Iceberg tables.”
↩︎ Iceberg tables and external tables: data outside Snowflake-managed storage“you can use Snowflake as the Iceberg catalog, or use a catalog integration to connect Snowflake to an external Iceberg catalog.”
↩︎ Iceberg tables and external tables: data outside Snowflake-managed storage“Sync a Snowflake-managed Iceberg table with Snowflake Open Catalog so that third-party compute engines can query the table.”
↩︎ Iceberg tables and external tables: data outside Snowflake-managed storage - 4.
“Simple, easily defined, consumes no storage.”
↩︎ Standard, secure and materialized views“Because the result is pre-computed, querying a materialized view is faster than executing a query against the base table of the view.”
↩︎ Standard, secure and materialized views“Dynamic tables materialize the results of a specified query.”
↩︎ Where dynamic tables fit next to materialized views - 5.
“specify the SECURE keyword in the CREATE VIEW or CREATE MATERIALIZED VIEW command.”
↩︎ Standard, secure and materialized views“the Snowflake optimizer could re-order the predicates in the WHERE clauses.”
↩︎ Standard, secure and materialized views“Secure views can execute more slowly than non-secure views.”
↩︎ Standard, secure and materialized views“Secure views can execute more slowly than non-secure views.”
↩︎ Exam trap 4 - 6.
“Each materialized view stores query results, which adds to the monthly storage usage for your account.”
↩︎ Standard, secure and materialized views“suspending maintenance typically only defers costs, rather than reducing them.”
↩︎ Standard, secure and materialized views“If a base table is altered so that existing columns are changed or dropped, then all materialized views on that base table are suspended”
↩︎ Standard, secure and materialized views - 7.
“No (minimum TARGET_LAG setting is 1 minute)”
↩︎ Where dynamic tables fit next to materialized views“SQL-based pipeline with joins or aggregations | Preferred | Possible | No (single table only)”
↩︎ Where dynamic tables fit next to materialized views“Materialized views accelerate repeated queries against a single base table.”
↩︎ Where dynamic tables fit next to materialized views