CertSafari
    Snowflake SnowPro Advanced: Architect (ARA-C01)· Lessons

    Domain 3 · Lesson 11/13

    Views, materialized views, dynamic tables, and streams and tasks in Snowflake

    Determine the appropriate data transformation solution to meet business needs.

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

    What you will be able to do

    • Choose between a view, a materialized view, a dynamic table and a hand-built table for a transformation, based on read speed, freshness and cost
    • Weigh the benefits, limitations and properties of views and materialized views, including recursion, schema resolution and SECURE
    • Configure a dynamic table's target lag and refresh mode, and recognise what it cannot contain
    • Explain when a stream's offset advances and how tasks consume streams on a schedule or trigger
    • Place staging tables and change capture correctly in a layered pipeline

    Key concept

    Declarative versus imperative transformation — With a dynamic table you declare the result you want as a SELECT, plus how fresh it must be, and Snowflake works out the dependencies and refreshes. With streams and tasks you write the change capture, the scheduling and the processing logic yourself.

    1.Views, materialized views and tables: who pays for freshness

    Most transformations in Snowflake end up in one of four forms. A view recomputes on every read. A materialized view stores its result and keeps it current. A dynamic table materializes one step of a pipeline. A plain table is filled by code you write. Choosing among them means trading read speed and freshness against who pays to keep the result current, and how.

    A standard view is a named query and nothing more. Its results come from running the query each time the view is referenced, and nothing is kept for later. It uses no storage, but every read spends warehouse compute. That makes views the right tool for modular SQL, for reuse, and for access control: you can grant a role privileges on a view without granting it anything on the tables underneath. The view's owner role must still be able to read those tables.

    A materialized view behaves more like a table than a view. Its result is pre-computed and stored, so reads are fast. That pays off most for expensive aggregation, projection and selection that run often on large data sets. The cost has two parts. The stored result adds to the account's monthly storage. Whenever the base table changes, a background service updates every materialized view defined on it. That service runs on Snowflake-provided compute billed in 1-second increments and appears under a warehouse named MATERIALIZED_VIEW_MAINTENANCE. Resource monitors cannot cap that warehouse. Materialized views also require Enterprise Edition or higher.

    Clustering a materialized view is allowed, but it multiplies maintenance. Take an append-only base table and a view clustered by postal code. A load of 100 new rows that fills one or two base-table micro-partitions can force rewrites of 100 micro-partitions in the view. Suspending the view does not save that money. It only defers maintenance, which builds up while the view is suspended. Schema changes are the other risk: changing or dropping any existing base-table column suspends every materialized view on that table, even views that never used the column. A suspended view cannot be resumed. You recreate it, usually with CREATE OR REPLACE MATERIALIZED VIEW ... COPY GRANTS.

    The three common ways to transform data with a query, compared
    ObjectHow results are producedStorageKeeping it currentMain drawback
    ViewQuery runs each time the view is referencedNoneNothing to maintain; compute is spent on every readSlow and inflexible for heavy queries
    Materialized viewPre-computed and storedConsumes storageAlways up to date; compute is spent on background maintenanceMaintenance compute and storage cost
    Dynamic tableMaterialized from a SELECT and refreshed automaticallyConsumes storageRefreshed according to the criteria you setYou must decide how often, when and how to refresh

    A standard view's benefits are simplicity and reuse; its limitation is paying for every read. It is easy to define and consumes no storage. One definition can serve many queries or be stacked into hierarchies, such as a medical_staff view built from doctors and nurses views, and each layer can be debugged on its own. Because nothing is stored, though, a view over an expensive join or aggregation repeats that work for every caller. When the same heavy query runs many times an hour, that is the signal to move to a stored result.

    Several properties change how a view behaves. A standard view can be recursive, through a recursive CTE or the RECURSIVE keyword, while materialized views carry restrictions that standard views do not. A table named without a schema resolves to the view's own schema rather than the session's active one, so the view reads the same table whoever queries it. SECURE can be set on either kind of view. It shows the definition only to the owner role and keeps the optimizer from reordering filters, which blocks the trick of provoking a divide-by-zero error to learn that hidden rows exist. The price is slower execution, so reserve it for privacy and not for views built only for convenience.

    Checkpoint 1 of 7· Match them up

    Match each way of producing a transformation result to how it is kept current and who pays for that.

    Tap a term, then the definition that fits it.

    Checkpoint 2 of 7· 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?

    Sources12345

    2.Dynamic tables: declare the result and a target lag

    A dynamic table applies the stored-result idea to a whole pipeline. You write a SELECT and a target lag. Snowflake finds the base tables, watches them, and refreshes the result. Each refresh is applied atomically, so readers never see a half-finished refresh. When dynamic tables read from one another, Snowflake works out the dependency graph from their queries. It then refreshes them in dependency order against a consistent snapshot, so you never script the execution order.

    A dynamic table that cleans raw orders, aiming to stay within 10 minutes of its sourcesql
    CREATE OR ALTER DYNAMIC TABLE dt_orders
        TARGET_LAG = '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 is a freshness goal, not a schedule. A lag of ten minutes means Snowflake tries to keep the data no more than ten minutes behind its sources. A slow refresh can still overshoot. Intermediate tables can use TARGET_LAG = DOWNSTREAM, which makes them refresh only when a dynamic table further down the pipeline needs fresh data. This avoids refreshes that nothing reads. Moving a batch pipeline toward near-real-time is largely a matter of lowering that one parameter, and the cost table below shows the price of doing so.

    Refresh modes
    REFRESH_MODEBehaviour
    INCREMENTALProcesses only the rows that changed since the last refresh
    FULLRefreshes the entire result set
    AUTOSnowflake chooses at creation time, based on whether the definition supports incremental refresh
    ADAPTIVEIncremental by default, but reinitializes automatically when large upstream changes are detected
    CUSTOM_INCREMENTALYou define the refresh logic yourself with DML statements
    The three cost categories of a dynamic table
    Cost categoryWhat drives it
    Warehouse computeWarehouse size, how often refreshes run, query complexity, data volume
    Cloud ServicesCompiling refreshes, tracking dependencies, monitoring changes; grows with pipeline depth, number of tables and shorter target lag
    StorageMicro-partitions added or replaced by refreshes, table size, Time Travel retention

    The limits mark where dynamic tables stop being the answer. The minimum target lag is 60 seconds and refresh timing is not guaranteed, so data that must be fresher, or refreshed at an exact time, needs another tool. The definition cannot call stored procedures or external functions, and UDTFs are allowed only inside lateral joins. The working rule is this: logic you can write as a SQL SELECT is a candidate. Setting SCHEDULER = DISABLE hands refresh control to an external tool such as dbt or Airflow. Compared with a materialized view, a dynamic table is the more flexible option. It supports joins, window functions and multi-step chains with automatic dependency tracking, and gives you finer control over refresh.

    Checkpoint 3 of 7· Check yourself

    A team plans to replace its stream-and-task pipelines with dynamic tables. Which of these pipelines has to stay on streams and tasks?

    Checkpoint 4 of 7· Exam question

    A finance team currently maintains a nightly stored procedure and task pair that recomputes a summary table from three source tables using full recomputation logic the team wrote by hand. They want to replace this with a declarative object that automatically tracks dependencies and refreshes on a lag target, without them writing custom orchestration code. Which options correctly describe capabilities of the object they should adopt? (Select all that apply.)(Select 3)

    0 of 3 selected

    Sources6

    3.Streams and tasks: capturing and processing changes yourself

    Streams and tasks are the imperative alternative. You capture changes and decide yourself when and how to process them. A stream records inserts (including COPY INTO), updates and deletes on a source object and exposes them as a change table. Supported sources include standard tables, views, dynamic tables and external tables. A stream holds no table data, only an offset. Creating the first stream on a table adds hidden change-tracking columns to that table, which use a small amount of storage.

    Each change row has the source's columns plus METADATA$ACTION, METADATA$ISUPDATE and METADATA$ROW_ID. An UPDATE appears as a DELETE and INSERT pair with METADATA$ISUPDATE set to TRUE. A stream returns the net difference between two offsets, so a row inserted and then updated since the offset appears as one new row.

    The offset moves only when DML consumes the stream. CREATE TABLE AS SELECT also counts as consuming it. Several queries can read the same changes without moving the offset. To make several DML statements process the same change set, wrap them in BEGIN ... COMMIT. The stream advances when the transaction commits and stays where it was if the transaction fails.

    A task supplies the scheduling. It can run SQL, a stored procedure, or code in Python, Java, Scala, JavaScript or Snowflake Scripting. It runs on an interval or a CRON schedule, or when a trigger fires. Every new task starts suspended until you run ALTER TASK ... RESUME. Snowflake runs only one instance of a scheduled task at a time: if a run is still going when the next slot arrives, that slot is skipped. A WHEN SYSTEM$STREAM_HAS_DATA condition ties a task to a stream, so the task does nothing when nothing has changed. Task graphs link tasks in series or in parallel for multi-step workflows.

    A triggered task that consumes a stream only when it has new rowssql
    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;
    Choosing the compute model for a task
    FactorServerless taskUser-managed task
    SetupOmit WAREHOUSE; Snowflake sizes the compute from recent runsInclude WAREHOUSE
    BillingActual compute resource usageWarehouse size, with a 60-second minimum each time the warehouse resumes
    Schedule adherenceRecommended when keeping to the interval matters; compute grows if a run overrunsRecommended when keeping to the interval matters less
    Size ceilingEquivalent to XXLARGE, bounded by SERVERLESS_TASK_MAX_STATEMENT_SIZEAny warehouse size you choose

    Checkpoint 5 of 7· Check yourself

    An hourly task loads a stable volume of data, and its runs must keep to the hourly interval. Its current warehouse is mostly idle between runs, and the workload fits well within an XXLARGE warehouse. How should the task be set up?

    Checkpoint 6 of 7· Check yourself

    Two INSERT ... SELECT statements must each load the same change records from orders_stream, into two different target tables. When they run one after another in autocommit mode, the second INSERT finds the stream empty. What fixes this?

    Sources78

    4.Staging tables and choosing a pipeline pattern

    Landed data waits in a staging layer before it is transformed into the next zone, as described in Data warehouse zones/layers and data lake directory structure. Staging and intermediate tables are usually transient, because their contents can be rebuilt from the source and so do not need to pay for Fail-safe storage. See Table types: permanent, transient, temporary.

    Change capture works well on the staging layer. A stream on a staging table lets the next step transform only the rows that changed since the last extraction, and a triggered task runs that step only when there is something to process. A dynamic table that reads from the same staging table does the same job without any stream or task code. The choice between them depends on what the logic contains, not on how much data there is.

    Matching a requirement to a transformation object
    RequirementFits bestWhy
    Reusable logic or a role-scoped subset of columns, no storageViewConsumes no storage; computed when queried
    Very fast reads on a frequent, expensive aggregationMaterialized viewPre-computed result kept current in the background
    Multi-step SQL with joins, aggregations or window functions, freshness of 60 seconds or moreDynamic tableDeclarative; Snowflake infers dependencies and schedules refreshes
    Stored procedures, external functions, or strictly guaranteed timingStreams and tasksDynamic tables do not support these workloads

    Consider a nightly task that runs a stored procedure to recompute a summary from scratch, even on nights when no data arrived. There are two ways to stop paying for empty runs. A dynamic table with a 15-minute target lag and incremental refresh rebuilds only what changed, keeps the summary close to current, and removes the orchestration code. If the logic really needs a stored procedure, keep the task but put a stream on the source tables and add a WHEN SYSTEM$STREAM_HAS_DATA condition, so the task skips runs with no new data.

    Checkpoint 7 of 7· Match them up

    Four downstream needs read from one staging layer. Pair each transformation object with the need it fits best.

    Tap a term, then the definition that fits it.

    Sources786

    Sources

    (8)

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

    1. 1.
      “A non-materialized view’s results are created by executing the query at the time that the view is referenced in a query.”
      ↩︎ Views, materialized views and tables: who pays for freshness
      “you can grant privileges on a particular view to a particular role, without the grantee role having privileges on the table(s) underlying the view.”
      ↩︎ Views, materialized views and tables: who pays for freshness
      “A materialized view’s results are stored, almost as though the results were a table.”
      ↩︎ Views, materialized views and tables: who pays for freshness
      “A non-materialized view can be recursive (i.e. the view can refer to itself).”
      ↩︎ Views, materialized views and tables: who pays for freshness
      “materialized views have some restrictions that non-materialized views do not have.”
      ↩︎ Views, materialized views and tables: who pays for freshness
      “then Snowflake assumes that the table is in the same schema as the view.”
      ↩︎ Views, materialized views and tables: who pays for freshness
    2. 2.
    3. 3.
      “Simple, easily defined, consumes no storage.”
      ↩︎ Views, materialized views and tables: who pays for freshness
      “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 tables: who pays for freshness
    4. 4.
      “Maintaining clustering (of either a table or a materialized view) adds costs.”
      ↩︎ Views, materialized views and tables: who pays for freshness
      “If a base table is altered so that existing columns are changed or dropped, then all materialized views on that base table are suspended”
      ↩︎ Views, materialized views and tables: who pays for freshness
      “you cannot use them to control credit usage for the Snowflake-provided warehouses, including the MATERIALIZED_VIEW_MAINTENANCE warehouse.”
      ↩︎ Views, materialized views and tables: who pays for freshness
      “suspending maintenance typically only defers costs, rather than reducing them.”
      ↩︎ Exam trap 3
      “Snowflake performs automatic background maintenance of materialized views.”
      ↩︎ Prediction
    5. 5.
      “The Search Optimization Service and materialized views also require the Enterprise Edition or higher”
      ↩︎ Views, materialized views and tables: who pays for freshness
    6. 6.
      “The new results are applied to the dynamic table atomically, so readers never see a partial refresh.”
      ↩︎ Dynamic tables: declare the result and a target lag
      “actual lag can exceed the target when refreshes take longer than expected”
      ↩︎ Dynamic tables: declare the result and a target lag
      “You can also set TARGET_LAG = DOWNSTREAM on intermediate tables so they refresh only when their downstream dependents need fresh data.”
      ↩︎ Dynamic tables: declare the result and a target lag
      “Require data fresher than 60 seconds (the minimum target lag) or strictly guaranteed refresh timing.”
      ↩︎ Dynamic tables: declare the result and a target lag
      “target lag (shorter lag means more scheduling work)”
      ↩︎ Dynamic tables: declare the result and a target lag
      “if your logic is expressible as a SQL SELECT statement, it is a candidate for a dynamic table.”
      ↩︎ Staging tables and choosing a pipeline pattern
      “Prefer a declarative approach where you define the desired result and let Snowflake handle scheduling.”
      ↩︎ Key concept
      “Need stored procedures or external functions in the definition.”
      ↩︎ Exam trap 2
      “Need stored procedures or external functions in the definition.”
      ↩︎ Checkpoint
      “As a general rule, if your logic is expressible as a SQL SELECT statement, it is a candidate for a dynamic table.”
      ↩︎ Checkpoint
    7. 7.
      “Note that a stream itself does not contain any table data.”
      ↩︎ Streams and tasks: capturing and processing changes yourself
      “Updates to rows in the source object are represented as a pair of DELETE and INSERT records in the stream”
      ↩︎ Streams and tasks: capturing and processing changes yourself
      “only the data in staging tables that has changed since the last extraction is transformed and copied into other tables.”
      ↩︎ Staging tables and choosing a pipeline pattern
      “Querying a stream alone does not advance its offset, even within an explicit transaction”
      ↩︎ Exam trap 1
      “A stream advances the offset only when it is used in a DML transaction.”
      ↩︎ Prediction
      “To ensure multiple statements access the same change records in the stream, surround them with an explicit transaction statement (BEGIN .. COMMIT).”
      ↩︎ Checkpoint
    8. 8.
      “If a task is still running when the next scheduled run time occurs, then that scheduled time is skipped.”
      ↩︎ Streams and tasks: capturing and processing changes yourself
      “Task graphs can use logic to perform dynamic behavior, running tasks in parallel or in series.”
      ↩︎ Streams and tasks: capturing and processing changes yourself
      “The maximum compute size for a serverless task is equivalent to an XXLARGE virtual warehouse.”
      ↩︎ Streams and tasks: capturing and processing changes yourself
      “it eliminates frequent polling of the source when new data arrival is unpredictable.”
      ↩︎ Staging tables and choosing a pipeline pattern
      “Recommended when adherence to the schedule interval is highly important.”
      ↩︎ Checkpoint

    Continue to part 2 of 2

    FLATTEN, UDFs, stored procedures, external and secure functions in Snowflake

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