What you will be able to do
- Compare views, materialized views and dynamic tables by storage, compute cost and query speed
- State the benefits, limitations and key properties of views, materialized views and dynamic tables, and match them to a business need
- Configure a dynamic table's target lag and refresh mode, and recognise the workloads it cannot handle
- Explain how a stream's offset advances and how a task is scheduled or triggered by a stream
- Choose between serverless and user-managed compute for tasks based on cost and schedule adherence
Key concept
Declarative vs explicit transformation pipelines — With a dynamic table you state the result you want (a SELECT) and how fresh it must be, and Snowflake works out dependencies and refresh scheduling. With streams and tasks you capture the changes and schedule the processing yourself. Most transformation design questions come down to picking one of these two models.
1.Views, materialized views and dynamic tables: properties and cost
Every transformation design starts with a basic choice: compute the result each time someone asks for it, or store it ahead of time. A standard view takes the first approach. In Snowflake, a view lets the result of a query be accessed as if it were a table. It can join two or more tables or other views into one logical object, and once it is defined you query it like any other table. Because a view stores only its definition, it uses no storage. The cost is that every query recomputes the result on a warehouse.
Materialized views and dynamic tables both store their result. A materialized view pre-computes its dataset, so reading it is faster than running the query against the base table. The difference is largest when the query runs often or is complex, and it helps most with expensive aggregation, projection and selection over large data sets. A dynamic table also materializes a query result. Instead of building a target table and writing your own code to keep it updated, you declare the transforming SQL and background automation keeps it current. Both stored options pay for that speed in the same way: they use storage, and they need compute to stay up to date.
| Object type | Pros | Cons |
|---|---|---|
| View | Simple, easily defined, consumes no storage. | Inflexible, slow, requires compute to generate results. |
| Materialized View | Fast results retrieval. Relatively simple definition. Somewhat flexible. Always up to date. | Incurs compute to keep up to date. Consumes storage. |
| Dynamic Tables | Extremely fast results retrieval. Relatively simple definition. Very flexible. Fine control on refresh. Can provide complex transformations. | Incurs compute cost to be kept up to date. Consumes storage. Requires careful consideration as to how often to refresh, and when and how to refresh. |
Read the table as benefits against limitations. A view's benefits are that it is simple, easily defined and consumes no storage. Its limitations are that it is inflexible and slow, because it requires compute to generate results. A materialized view's benefits are fast results retrieval, a relatively simple definition, some flexibility and results that are always up to date. Its limitations are the compute needed to keep it up to date and the storage it consumes. A dynamic table's benefits are extremely fast retrieval, a very flexible definition, fine control on refresh and support for complex transformations. Its limitations are the same compute and storage cost, plus the need to decide carefully how often, when and how to refresh. The properties that separate the three are storage use, compute needed to stay current, flexibility and refresh control. Match them to the need: choose a view when simplicity and zero storage matter more than speed, a materialized view or dynamic table when reads must be fast and you accept paying compute and storage to keep results current, and a dynamic table when the transformation is complex or you need control over refresh. Snowflake documents object-specific limitations on separate pages (Limitations on Views and Working with Materialized Views); this lesson covers the summary comparison, not those full lists.
Views also affect change capture. You can create a stream on a view, including a secure view. However, a stream on a view needs change tracking turned on explicitly for the view and for its underlying tables, so that the hidden change-tracking columns are added to those tables. A view is therefore not free in a CDC design: it relies on metadata stored in the tables underneath it.
Checkpoint 1 of 6· Check yourself
Which statement about a standard (non-materialized) Snowflake view is accurate?
A view stores only its definition, so it uses no storage, and every query has to compute the result. Pre-computation belongs to materialized views, and lag-based refresh belongs to dynamic tables.
“Inflexible, slow, requires compute to generate results.”Source: docs.snowflake.com
2.Dynamic tables: target lag, refresh modes, costs and limits
A dynamic table definition answers three questions: what the table contains (the SELECT), how fresh it must be (TARGET_LAG), and how Snowflake refreshes it (REFRESH_MODE). After you create it, Snowflake parses the query, identifies its base tables, watches them for changes, and refreshes the table to stay within the lag you set.
Checkpoint 2 of 6· Fill the gap
Which parameter tells Snowflake how fresh this dynamic table must be?
CREATE OR ALTER DYNAMIC TABLE dt_orders
? = '10 minutes'
WAREHOUSE = transform_wh
REFRESH_MODE = INCREMENTAL
AS
SELECT
order_id,
customer_id,
order_date,
TRIM(UPPER(product_name)) AS product_name,
quantity,
unit_price,
quantity * unit_price AS line_total,
order_status
FROM raw_orders
WHERE order_status != 'returned';TARGET_LAG sets the freshness target. SCHEDULE and TARGET_COMPLETION_INTERVAL are task parameters, and REFRESH_MODE already appears in the statement, where it controls how the refresh is computed.
Source: docs.snowflake.comEach refresh follows the same sequence. Snowflake detects that a base table has changed. It then computes either only the changed rows (incremental) or the whole result (full). Finally it applies the new results atomically, so readers never see a partial refresh. When dynamic tables read from one another, Snowflake infers the dependency graph from their queries, chooses a consistent snapshot timestamp, and refreshes them in dependency order. You don't declare dependencies or script an execution order. Each table in the chain keeps its own target lag. An intermediate table can use TARGET_LAG = DOWNSTREAM so that it refreshes only when the tables that depend on it need fresh data.
Checkpoint 3 of 6· Put it in order
Put the steps of a single dynamic table refresh in order
- 1.The new results are applied to the dynamic table atomically
- 2.Snowflake computes only the changed rows (incremental) or the entire result set (full)
- 3.Snowflake detects that the base tables have changed
Change detection comes first, then computing the delta or the full result, and then an atomic apply, which is why readers never see a half-finished refresh.
“The new results are applied to the dynamic table atomically, so readers never see a partial refresh.”Source: docs.snowflake.com
| REFRESH_MODE | Behaviour |
|---|---|
| INCREMENTAL | Processes only the rows that changed since the last refresh |
| FULL | Refreshes the entire result set |
| AUTO | Snowflake chooses at creation time, based on whether the definition supports incremental refresh |
| ADAPTIVE | Incremental by default, but reinitializes automatically when large upstream changes are detected |
| CUSTOM_INCREMENTAL | You define your own refresh logic using DML statements |
Cost and performance depend on the lag you choose. Target lag is a target, not a guarantee: actual lag can exceed it when refreshes take longer than expected. Dynamic tables are billed in three categories. Shortening the lag increases more than refresh frequency. It also adds Cloud Services work for scheduling.
| Cost category | What it covers | Key factors |
|---|---|---|
| Warehouse compute | The virtual warehouse runs each refresh query. | Warehouse size, how often refreshes run, query complexity, data volume. |
| Cloud Services | Snowflake compiles the refresh query, tracks dependencies, monitors changes, and coordinates refreshes. | Query complexity, number of dynamic tables, pipeline depth, target lag (shorter lag means more scheduling work). |
| Storage | Refreshes add, replace, or remove micro-partitions in the table. | Dynamic table size, number of refreshes, Time Travel retention. |
As a rule of thumb, logic you can express as a SQL SELECT is a candidate for a dynamic table. Moving from batch to near-real-time freshness then means changing one parameter. There are firm limits, though. Dynamic tables don't support data fresher than 60 seconds (the minimum target lag) or strictly guaranteed refresh timing. Their definitions can't use stored procedures or external functions, or UDTFs outside of lateral joins. Workloads that need any of these belong with streams and tasks.
Checkpoint 4 of 6· Exam question
A team needs a view over a frequently queried aggregation that must return sub-second results, and they are willing to pay ongoing storage and maintenance credits to get that speed. Which properties correctly describe the object they should create?
Correct answer: A — It stores the query result physically like a table, supports clustering keys for tuning, and consumes background compute credits to stay current with base table changes.
- A. Correct - a materialized view stores its result set like a table, can define its own clustering key for query tuning, and Snowflake runs background maintenance that consumes compute credits whenever the base table changes to keep the stored result current.
- B. Incorrect - materialized views do support independent clustering keys, and background maintenance credits are charged continuously as base data changes, not only at creation.
- C. Incorrect - describing plan caching without physical storage misrepresents materialized views, which persist actual result rows rather than only caching a compiled plan.
- D. Incorrect - a materialized view can be granted independently of the base table privileges, so a querying role does not need direct access to the underlying tables to query the materialized view.
Sources3
3.Streams and tasks: explicit change capture and scheduling
When you need control that a dynamic table doesn't give you, you build the pipeline from two pieces. A stream records DML changes (inserts, including COPY INTO, plus updates and deletes) on a source object, along with metadata about each change. This is change data capture. A stream doesn't hold table data. It stores an offset, a bookmark in the source's version history, and returns change records by reading that history. Because of this you can create streams on standard tables, views, directory tables, dynamic tables, external tables and event tables, and on Apache Iceberg tables with limitations.
Several queries can read the same change data without moving the offset. It advances only when the stream is used in a DML transaction that commits. To have several statements see the same change records, wrap them in BEGIN ... COMMIT, because streams use repeatable read isolation. Each change record has the source's columns plus METADATA$ACTION (INSERT or DELETE), METADATA$ISUPDATE, and METADATA$ROW_ID. An UPDATE appears as a DELETE/INSERT pair with METADATA$ISUPDATE set to TRUE.
A task runs the processing. Tasks can run SQL commands or stored procedures on a fixed schedule (an interval or USING CRON), or they can be triggered when a stream has new data. A newly created task starts suspended: run it once with EXECUTE TASK, or let it run continuously with ALTER TASK ... RESUME. Only one instance of a scheduled task runs at a time, so if a run is still going when the next one is due, that scheduled run is skipped. Triggered tasks suit ELT pipelines because they avoid frequent polling when new data arrives unpredictably.
CREATE TASK triggered_task_stream
WHEN SYSTEM$STREAM_HAS_DATA('orders_stream')
AS
INSERT INTO completed_promotions
SELECT order_id, order_total, order_time, promotion_id
FROM orders_stream;The compute model drives both cost and performance. Serverless tasks omit the WAREHOUSE parameter. Snowflake sizes them from recent runs, within SERVERLESS_TASK_MIN_STATEMENT_SIZE and SERVERLESS_TASK_MAX_STATEMENT_SIZE, up to a ceiling equivalent to an XXLARGE warehouse. User-managed tasks name a warehouse and give you full control of it.
| Factor | Serverless tasks | User-managed tasks |
|---|---|---|
| Best fit | Under-utilized warehouses, quick or stable task runs | Fully utilized warehouses with multiple concurrent tasks, unpredictable loads |
| Billing | Actual compute resource usage | Warehouse size, with a 60-second minimum each time the warehouse is resumed |
| Schedule adherence | Recommended when it matters; Snowflake increases compute if a run exceeds the interval | Recommended when adherence is less important |
| Maximum size | Equivalent to XXLARGE | Any warehouse size you choose |
Checkpoint 5 of 6· Exam question
A data governance team wants to expose a view of a PII-containing table to a broad set of analyst roles, but they are worried that a clever analyst could reverse-engineer the masking logic in the view's SQL definition by studying the query optimizer's behavior. Which view property directly addresses this concern?
Correct answer: A — Declaring the view as SECURE, which hides the view definition from unauthorized users and disables optimizations that could otherwise leak information through the plan.
- A. Correct - a secure view withholds its underlying query text from users who only have privileges on the view, and Snowflake skips certain query optimizations for secure views specifically because those optimizations could otherwise expose details about the underlying data through query plans.
- B. Incorrect - materialization affects storage and performance, not whether the view's definition or masking logic is protected from inspection by analysts.
- C. Incorrect - clustering keys are a performance tuning mechanism for materialized views and tables; they have no bearing on whether a view's definition is concealed.
- D. Incorrect - the scope of the granting role object does not change whether the view's SQL text is visible to a user who has been granted SELECT on it.
Checkpoint 6 of 6· Match them up
Match each stream or task element to what it does
Tap a term, then the definition that fits it.
The offset is the stream's bookmark; METADATA$ISUPDATE flags update pairs; SYSTEM$STREAM_HAS_DATA turns a task into a triggered task; and tasks start suspended until resumed.
“A stream advances the offset only when it is used in a DML transaction.”Source: docs.snowflake.com
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.A dynamic table with a very short target lag can deliver sub-minute freshness with a guaranteed refresh time.Why is that wrong?
The minimum target lag is 60 seconds, and lag is a target rather than a guarantee. Actual lag can exceed it when refreshes run long.
Covered in Dynamic tables: target lag, refresh modes, costs and limits
2.A dynamic table definition can call a stored procedure or an external function to do part of the transformation.Why is that wrong?
Dynamic tables don't support workloads that need stored procedures or external functions in the definition. Use streams and tasks for those.
Covered in Dynamic tables: target lag, refresh modes, costs and limits
3.Selecting from a stream consumes its change records.Why is that wrong?
Only a committed DML transaction that uses the stream advances its offset. Any number of plain queries can read the same changes.
Covered in Streams and tasks: explicit change capture and scheduling
4.A serverless task will scale to whatever size the workload needs.Why is that wrong?
Serverless tasks are capped at the equivalent of an XXLARGE warehouse. Larger workloads need a user-managed task with a bigger warehouse.
Covered in Streams and tasks: explicit change capture and scheduling
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Because the result is pre-computed, querying a materialized view is faster than executing a query against the base table of the view.”
↩︎ Views, materialized views and dynamic tables: properties and cost“a view allows the result of a query to be accessed as if it were a table”
↩︎ Views, materialized views and dynamic tables: properties and cost“Requires careful consideration as to how often to refresh, and when and how to refresh.”
↩︎ Views, materialized views and dynamic tables: properties and cost“Simple, easily defined, consumes no storage.”
↩︎ Views, materialized views and dynamic tables: properties and cost“Inflexible, slow, requires compute to generate results.”
↩︎ Checkpoint - 2.
“for streams on views, change tracking must be enabled explicitly for the view and underlying tables”
↩︎ Views, materialized views and dynamic tables: properties and cost“Note that a stream itself does not contain any table data.”
↩︎ Streams and tasks: explicit change capture and scheduling“Multiple queries can independently consume the same change data from a stream without changing the offset.”
↩︎ Exam trap 3“Querying a stream alone does not advance its offset, even within an explicit transaction”
↩︎ Prediction“A stream advances the offset only when it is used in a DML transaction.”
↩︎ Checkpoint - 3.
“It infers the dependency graph from the queries and picks a consistent snapshot timestamp.”
↩︎ Dynamic tables: target lag, refresh modes, costs and limits“actual lag can exceed the target when refreshes take longer than expected.”
↩︎ Dynamic tables: target lag, refresh modes, costs and limits“As a general rule, if your logic is expressible as a SQL SELECT statement, it is a candidate for a dynamic table.”
↩︎ Dynamic tables: target lag, refresh modes, costs and limits“You specify a SELECT query and a target lag, and Snowflake tracks dependencies and refreshes the data on schedule.”
↩︎ Key concept“Require data fresher than 60 seconds (the minimum target lag) or strictly guaranteed refresh timing.”
↩︎ Exam trap 1“Need stored procedures or external functions in the definition.”
↩︎ Exam trap 2“The new results are applied to the dynamic table atomically, so readers never see a partial refresh.”
↩︎ Checkpoint - 4.https://docs.snowflake.com/en/user-guide/tasks-introOfficial docs
“Tasks can run at scheduled times or can be triggered by events, such as when new data arrives in a stream.”
↩︎ Streams and tasks: explicit change capture and scheduling“If a task is still running when the next scheduled run time occurs, then that scheduled time is skipped.”
↩︎ Streams and tasks: explicit change capture and scheduling“It doesn’t ensure a task run is completed within the batch window.”
↩︎ Streams and tasks: explicit change capture and scheduling“The maximum compute size for a serverless task is equivalent to an XXLARGE virtual warehouse.”
↩︎ Exam trap 4