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

    Domain 3 · Lesson 14/24

    Snowflake tasks: compute, schedules, task graphs, privileges and troubleshooting

    Given a scenario, manage tasks.

    20 min read
    3% of exam
    5 sources
    Published 20 Oct 2026
    Docs as of 18 Oct 2026

    What you will be able to do

    • Choose between a serverless task and a user-managed task for a given workload, and configure each one
    • Set up interval, CRON and stream-triggered schedules, and start, suspend and retry task graphs
    • Grant the minimum privileges needed to create, own, run, operate and view tasks
    • Use TASK_HISTORY and SHOW TASKS to find out why a task did not run, how long it waited, and why it failed or timed out

    Key concept

    Task owner role — A task does not run as the person who created it. It runs as a system service with the privileges of the role that owns it. That role must hold the run-time privileges, and the task must be resumed, before any scheduled run happens.

    1.Serverless and user-managed tasks

    A task is a Snowflake object that runs SQL, a stored procedure call or Snowflake Scripting on a schedule or when an event happens. It replaces the external cron job that used to drive a data pipeline. Every run needs compute, and you choose where that compute comes from when you define the task. Serverless tasks get compute that Snowflake predicts and assigns. User-managed tasks run on a virtual warehouse that you name.

    The WAREHOUSE parameter decides which model you get. Leave it out and the task is serverless. Include it and the task runs on that warehouse. For a serverless task, Snowflake bases its sizing on a dynamic analysis of the task's most recent runs. When a schedule is set, it resizes so that future runs finish within that time frame.

    A serverless task that runs hourly. With no WAREHOUSE parameter, Snowflake supplies the computesql
    CREATE TASK SCHEDULED_T1
      SCHEDULE='60 MINUTES'
      AS SELECT 1;

    A brand-new serverless task has no history yet, so Snowflake can't predict a size for it. USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE sets the size for the first runs. If you leave it out, those runs use MEDIUM. After a few successful runs, Snowflake ignores the setting and sizes from history instead. Setting it together with WAREHOUSE produces a user error, because the parameter applies only to serverless tasks. Two more parameters set limits for later runs. SERVERLESS_TASK_MIN_STATEMENT_SIZE (default XSMALL) gives a floor for predictable performance, and SERVERLESS_TASK_MAX_STATEMENT_SIZE (default XXLARGE) gives a ceiling against unexpected costs.

    Serverless compute has a hard upper limit: XXLARGE. A workload that needs a larger warehouse has to be a user-managed task on a warehouse of that size. In return, a user-managed task gives you full control of the compute. That control comes with the job of sizing the warehouse, and if the warehouse is shared, you have to think about how the task affects the other workloads on it.

    When each compute model fits
    FactorServerless taskUser-managed task
    How it is definedOmit WAREHOUSE; optionally set USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZEInclude WAREHOUSE
    BillingActual compute resource usageWarehouse size, with a 60-second minimum each time the warehouse resumes
    Workload fitUnder-utilized warehouses, quick or relatively stable runsFully utilized warehouses with multiple concurrent tasks, unpredictable loads on the warehouse
    Schedule adherenceHighly important; Snowflake grows compute when a run exceeds the intervalLess important
    Maximum sizeEquivalent to XXLARGEWhatever warehouse you choose

    Take a MERGE that runs every five minutes and has no warehouse of its own. If you size a dedicated warehouse for it, you pay at least 60 seconds each time it resumes, and you have to pick a size for the worst run. If you put it on a busy shared warehouse, it competes with every other query there. A serverless task avoids both problems: you pay for the compute it actually uses, and Snowflake resizes after each run. User-managed wins in the opposite case, where a warehouse already runs many concurrent tasks at full utilization and adding one more costs almost nothing. "Unpredictable loads" in the table means unpredictable demand on a shared warehouse, not one task whose run time varies.

    Checkpoint 1 of 9· Fill the gap

    This hourly task must run on the existing COMPUTE_WH virtual warehouse, not on Snowflake-managed compute. Which parameter completes the definition?

    CREATE TASK SCHEDULED_T1
       ? ='COMPUTE_WH'
      SCHEDULE='60 MINUTES'
      AS SELECT 1;

    Checkpoint 2 of 9· Check yourself

    A nightly transformation task needs more compute than an XXLARGE warehouse provides. How should it be configured?

    Checkpoint 3 of 9· Exam question

    A pipeline runs a MERGE statement every 5 minutes. Run time varies from 10 seconds to 20 minutes depending on upstream volume, and no warehouse is dedicated to the job. The administrator wants to avoid sizing a warehouse or paying for idle warehouse time. Which approach is MOST appropriate?

    Sources12

    2.Schedules, stream triggers and the suspended start

    The SCHEDULE parameter takes one of two forms. An interval such as '10 SECONDS', '60 MINUTES' or '1 HOUR' repeats at a fixed spacing. A CRON expression with a time zone, such as 'USING CRON 7 3 * * SUN America/Los_Angeles', runs at a specific time or day: here, every Sunday at 3:07 a.m. Pacific. You can set either form in CREATE TASK or change it later with ALTER TASK.

    That rule is a reason to pick serverless when keeping to the schedule matters. A serverless task that overruns its interval gets more compute on the next run, while a user-managed task keeps missing slots until someone resizes its warehouse. More compute shortens some SQL but not all of it, so it doesn't guarantee that a run finishes in its window.

    A triggered task runs on an event instead of the clock. A WHEN SYSTEM$STREAM_HAS_DATA('orders_stream') condition runs the task when the stream has new rows. This suits ELT where new data arrives at unpredictable times: you don't keep polling the source, and the data is processed as soon as it lands. Serverless triggered tasks require a TARGET_COMPLETION_INTERVAL, which sets the time Snowflake scales compute to finish within. If you combine a schedule with a WHEN condition, the condition is checked on each scheduled run.

    A task that checks a stream for new data every hoursql
    CREATE TASK triggered_task_stream
      SCHEDULE = '1 HOUR'
      WHEN SYSTEM$STREAM_HAS_DATA('orders_stream')
      AS SELECT 1;

    Every new task is created suspended, including cloned tasks. A task with a valid schedule and fully privileged owner still does nothing until someone runs ALTER TASK … RESUME, which lets it follow its schedule or watch for events. EXECUTE TASK runs it once, which is how you test a task. It does not start the schedule, and a schedule doesn't need a manual run before it starts. When a task is resumed, Snowflake checks that the owner role has the privileges it needs to run the task. To change a task later, use ALTER TASK, or CREATE OR ALTER TASK to define its target state in one statement.

    Checkpoint 4 of 9· Check yourself

    Two hours after a data engineer ran CREATE TASK with SCHEDULE='60 MINUTES', TASK_HISTORY shows no runs at all. The owner role already holds every privilege it needs. What must the engineer do so the task runs on its schedule?

    Checkpoint 5 of 9· Exam question

    A developer ran CREATE TASK with SCHEDULE = '5 MINUTE' using a role that has every required privilege. An hour later TASK_HISTORY shows no runs for the task. What is the MOST likely cause and fix?

    Sources1

    3.Building and operating task graphs

    A task graph (a directed acyclic graph, or DAG) chains tasks into a workflow. It has one root task, dependent child tasks, and no loops. Only the root carries the schedule or trigger. Each child names its parents with AFTER. Children that share a parent run in parallel, and a child with several parents waits until all of them succeed.

    A root task with two parallel children and a third child that waits for bothsql
    CREATE TASK task_root
      SCHEDULE = '1 MINUTE'
      AS SELECT 1;
    
    CREATE TASK task_a
      AFTER task_root
      AS SELECT 1;
    
    CREATE TASK task_b
      AFTER task_root
      AS SELECT 1;
    
    CREATE TASK task_c
      AFTER task_a, task_b
      AS SELECT 1;

    A graph has structural limits. It can hold at most 1000 tasks, and each task can have at most 100 parents and 100 children. Every task in the graph must have the same owner and live in the same database and schema. If you transfer ownership of a single task, that task loses its links to its parents and children. To transfer a whole graph and keep its links, use GRANT OWNERSHIP on all tasks in the schema, or drop the owning role. You can attach an optional finalizer, created with CREATE TASK … FINALIZE = task_root, which runs after all other tasks complete or fail. Use it for cleanup or notifications. Each root can have only one finalizer, and a finalizer can't have children.

    To start a graph, resume each child task (including the finalizer) and then resume the root. Or call SYSTEM$TASK_DEPENDENTS_ENABLE on the root, which resumes every task in the graph at once. To change a task in a running graph, suspend the root first. The run already in progress finishes, and future scheduled runs are cancelled. The children keep their state, so resuming the root alone restarts the graph. To leave one step out, suspend that child: the graph continues as though it had succeeded. To list all tasks in a graph, pass the root to the TASK_DEPENDENTS table function.

    Failures spread through a graph. If any child fails, the whole graph run counts as failed, and the children of a failed parent are skipped. EXECUTE TASK … RETRY LAST reruns the latest graph run from the task that failed. Setting TASK_AUTO_RETRY_ATTEMPTS on the root retries the whole graph straight away instead of waiting for the next scheduled run. After 10 consecutive failures, a graph is suspended. Change that number with SUSPEND_TASK_AFTER_NUM_FAILURES on the root.

    Checkpoint 6 of 9· Fill the gap

    You want to add a cleanup step to the graph built from task_root, task_a, task_b and task_c. It must run once after all other tasks in the graph complete or fail. Which task name completes the finalizer definition?

    CREATE TASK task_finalizer
      FINALIZE =  ? 
      AS SELECT 1;

    Sources3

    4.Privileges to create, run, operate and view tasks

    Creating a task and running it need different sets of privileges. Creating one is ordinary object creation in a schema. Running one depends on the owner role holding account-level grants, which are covered under Account-level (global) privileges. For tasks, two of those grants matter: the owner role needs EXECUTE TASK before any task it owns can run, and also EXECUTE MANAGED TASK if the task is serverless.

    Minimum privileges to create a task and for its owner to run it
    ObjectTo create the taskFor the owner to run the task
    AccountEXECUTE MANAGED TASK (serverless only)EXECUTE TASK; plus EXECUTE MANAGED TASK (serverless only)
    DatabaseUSAGEUSAGE
    SchemaUSAGE, CREATE TASKUSAGE
    Task—USAGE
    WarehouseUSAGE (user-managed only)USAGE (user-managed only)

    The owner role also needs every privilege the task's own SQL needs, such as INSERT on the target table. A role that only creates serverless tasks never needs a warehouse grant. A role that creates user-managed tasks never needs EXECUTE MANAGED TASK. A common setup grants the account-level privileges to a custom role and then grants that role to the task-owning roles. To stop a role's tasks from running, revoke that custom role. Revoking EXECUTE TASK prevents all subsequent runs from starting under that role.

    Granting both account-level task privileges to a custom role, which is then granted to task ownerssql
    USE ROLE accountadmin;
    
    GRANT EXECUTE TASK, EXECUTE MANAGED TASK ON ACCOUNT TO ROLE taskadmin;

    Some people need to operate or inspect tasks without owning them:

    • Operating: a role with OPERATE on the task, plus USAGE on its database and schema, can suspend and resume it. It needs nothing else.
    • Viewing: you can see tasks if you have the ACCOUNTADMIN role, OWNERSHIP of the task, or the global MONITOR EXECUTION privilege. MONITOR EXECUTION is for viewing only and plays no part in creating tasks.
    • Identity: by default, a task runs as a system service, not as a user. A dropped or locked user therefore doesn't stop it. EXECUTE AS USER runs it as a named user instead, which requires the owner role to hold IMPERSONATE on that user.

    Dropping a task's owner role transfers ownership to the role that ran DROP ROLE, and the task pauses. No new runs are scheduled until the new owner resumes it. A run already in progress finishes under the dropped role.

    Checkpoint 7 of 9· Match them up

    Each privilege below gives a role a different ability over tasks. Match each one to what it allows or when it is required.

    Tap a term, then the definition that fits it.

    Checkpoint 8 of 9· Exam question

    A role named etl_dev must be able to create (but not yet run) a serverless task in schema ETL.JOBS. Select THREE privileges that the role needs for this.(Select 3)

    0 of 3 selected

    Sources1

    5.Troubleshooting runs with TASK_HISTORY

    When a task doesn't do what you expected, start with the history before changing anything. Query the TASK_HISTORY table function to see whether the task ran at all. A task can run successfully while the SQL inside it fails, so note the scheduled and completed times and any error code and message. In the Account Usage TASK_HISTORY view, completed runs show a STATE of SUCCEEDED, FAILED, CANCELLED or SKIPPED. That view leaves out runs that are still scheduled or executing, which only the Information Schema table function returns.

    If the history shows no runs, work through these causes in order:

    1. The task is still suspended. Check its state with SHOW TASKS or DESCRIBE TASK, then run ALTER TASK … RESUME, or SYSTEM$TASK_DEPENDENTS_ENABLE for a whole graph.
    2. The schedule hasn't come round yet. Check the cron expression and confirm that at least one scheduled time has passed.
    3. The owner role is missing a privilege. Use SHOW GRANTS TO ROLE to check that it has EXECUTE TASK and the USAGE grants.
    4. The trigger had nothing to act on. For a SYSTEM$STREAM_HAS_DATA condition, confirm that the stream had change records when the task was last scheduled.
    5. A predecessor failed. Children of a failed parent are skipped.

    The history also shows how long each run took, split into two parts. Queuing time runs from SCHEDULED_TIME to QUERY_START_TIME and is the time spent waiting for compute. Execution time runs from QUERY_START_TIME to COMPLETED_TIME. Long queuing on a user-managed task usually means its warehouse is shared or busy. Serverless tasks count queuing time against their target completion interval and scale to cover it.

    Each run has a 60-minute default limit, which protects against tasks that never finish. A timed-out run always shows as FAILED in the task history. How the different timeout parameters interact is covered in Timeout parameters. For tasks, the practical fix has three options. First check whether a custom limit is already set. If the warehouse is undersized, increase it. Otherwise raise the limit with ALTER TASK … SET USER_TASK_TIMEOUT_MS = <num>. Neither fix helps if the SQL has query parallelization issues. In that case, rewrite the statement.

    Checking whether a task has a custom timeout. No result means the default 3600000 ms (60 minutes) appliessql
    SHOW PARAMETERS LIKE 'USER_TASK_TIMEOUT_MS' IN TASK <task_name>;

    Checkpoint 9 of 9· Fill the gap

    Several runs of a nightly task appear as FAILED in TASK_HISTORY, each about 60 minutes after it started. Before raising any limit, you want to see whether the task already has a custom run timeout. Which parameter name completes the statement?

    SHOW PARAMETERS LIKE ' ? ' IN TASK <task_name>;

    Sources451

    Sources

    (5)

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

    1. 1.
      “Serverless tasks: Snowflake predicts resources that are needed and assigns them automatically.”
      ↩︎ Serverless and user-managed tasks
      “For user-managed tasks, billing for warehouses is based on warehouse size, with a 60-second minimum each time the warehouse is resumed.”
      ↩︎ Serverless and user-managed tasks
      “For serverless tasks, Snowflake bills your account based on the actual compute resource usage.”
      ↩︎ Serverless and user-managed tasks
      “If a task is still running when the next scheduled run time occurs, then that scheduled time is skipped.”
      ↩︎ Schedules, stream triggers and the suspended start
      “A target completion interval is required for serverless triggered tasks.”
      ↩︎ Schedules, stream triggers and the suspended start
      “When a task is created, it starts as suspended.”
      ↩︎ Schedules, stream triggers and the suspended start
      “Revoking the EXECUTE TASK privilege on a role prevents all subsequent task runs from starting under that role.”
      ↩︎ Privileges to create, run, operate and view tasks
      “In addition to the task owner, a role that has the OPERATE privilege on the task can suspend or resume the task.”
      ↩︎ Privileges to create, run, operate and view tasks
      “When a task transfers ownership, it is automatically paused and new task runs aren’t scheduled until the new owner resumes the task.”
      ↩︎ Privileges to create, run, operate and view tasks
      “To calculate queueing time, query TASK_HISTORY view and compare SCHEDULED_TIME with QUERY_START_TIME.”
      ↩︎ Troubleshooting runs with TASK_HISTORY
      “The system service runs the task using the same privileges as the task owner.”
      ↩︎ Key concept
      “When a task is created, it starts as suspended.”
      ↩︎ Exam trap 1
      “Required only for tasks that rely on serverless compute resources.”
      ↩︎ Exam trap 2
      “The maximum compute size for a serverless task is equivalent to an XXLARGE virtual warehouse.”
      ↩︎ Exam trap 3
      “If a task workload requires a larger warehouse, create a user-managed task with a warehouse of the required size.”
      ↩︎ Checkpoint
      “it starts as suspended. To allow a task to follow a schedule or detect events continuously, use ALTER TASK … RESUME.”
      ↩︎ Checkpoint
      “Account | EXECUTE MANAGED TASK | Required only for tasks that rely on serverless compute resources.”
      ↩︎ Checkpoint
    2. 2.
      “Omit this parameter to use serverless compute resources for runs of this task.”
      ↩︎ Serverless and user-managed tasks
      “If the parameter is omitted, the first runs of the task are executed using a medium-sized (MEDIUM) warehouse.”
      ↩︎ Serverless and user-managed tasks
    3. 3.
      “When multiple child tasks have the same parent, the child tasks run in parallel.”
      ↩︎ Building and operating task graphs
      “All tasks in a task graph must have the same task owner and be stored in the same database and schema.”
      ↩︎ Building and operating task graphs
      “By default, a task graph is suspended after 10 consecutive failures.”
      ↩︎ Building and operating task graphs
    4. 4.
      “Query the TASK_HISTORY table function to verify the task did not run.”
      ↩︎ Troubleshooting runs with TASK_HISTORY
      “There is a 60 minute default limit on a single run of a task.”
      ↩︎ Troubleshooting runs with TASK_HISTORY
    5. 5.
      “Status of the completed task: SUCCEEDED, FAILED, CANCELLED, or SKIPPED.”
      ↩︎ Troubleshooting runs with TASK_HISTORY
      “The timed-out tasks always have a FAILED state in the task history.”
      ↩︎ Exam trap 4

    Ready to test yourself?

    Practise the 11 questions on this subdomain.

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