Snowflake

Snowflake Serverless Tasks Complete Guide: Warehouse-Free Task Execution

2026-03-26
更新: 2026-03-27
NicheeLab Editorial Team

Snowflake Serverless Tasks are a task execution platform where Snowflake automatically runs SQL statements or stored procedures without requiring you to create or manage a virtual warehouse upfront. Because Snowflake handles compute start-up, sizing, and shutdown automatically, operational overhead drops dramatically.

Serverless Tasks vs User-managed Tasks

Snowflake tasks come in two flavors: Serverless Tasks (no warehouse required) and User-managed Tasks (warehouse specified via the WAREHOUSE clause). Understanding the differences accurately is critical both for the exam and for real-world design.

CriterionServerless TasksUser-managed Tasks
Warehouse specificationNot required (only the initial size is set via USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE)Explicit WAREHOUSE = <name> is required
Automatic size adjustmentSnowflake auto-resizes based on execution historyManual ALTER WAREHOUSE ... SET WAREHOUSE_SIZE required
Billing modelServerless Credit (1.5x multiplier) x execution timeWarehouse Credit x uptime (60-second minimum billing)
Idle costCharged only for execution time (zero idle cost)Idle time until AUTO_SUSPEND is also billed
Start-up latencyQuick start from a Snowflake-managed poolWaits for resume if the warehouse is SUSPENDED
Required privilegesEXECUTE MANAGED TASK (account level)USAGE on WAREHOUSE + CREATE TASK
Best fitLow-frequency batches, short tasks, standalone tasksAlways-on pipelines, large long-running batches

Creating a Serverless Task in SQL

For a Serverless Task, you omit the WAREHOUSE clause and instead use the USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE parameter to specify the initial compute size.

-- Serverless Task creation
CREATE OR REPLACE TASK etl_daily_aggregate
  USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE = 'MEDIUM'
  SCHEDULE = 'USING CRON 0 2 * * * Asia/Tokyo'
  ERROR_ON_NONDETERMINISTIC_MERGE = FALSE
AS
  MERGE INTO analytics.daily_summary AS tgt
  USING (
    SELECT
      event_date,
      COUNT(*) AS event_count,
      SUM(revenue) AS total_revenue
    FROM raw.events
    WHERE event_date = CURRENT_DATE() - 1
    GROUP BY event_date
  ) AS src
  ON tgt.event_date = src.event_date
  WHEN MATCHED THEN UPDATE SET
    event_count = src.event_count,
    total_revenue = src.total_revenue
  WHEN NOT MATCHED THEN INSERT
    (event_date, event_count, total_revenue)
    VALUES (src.event_date, src.event_count, src.total_revenue);

By contrast, a User-managed Task specifies the WAREHOUSE clause as shown below.

-- User-managed Task creation
CREATE OR REPLACE TASK etl_daily_aggregate_wh
  WAREHOUSE = etl_warehouse
  SCHEDULE = 'USING CRON 0 2 * * * Asia/Tokyo'
AS
  MERGE INTO analytics.daily_summary AS tgt
  USING (...) AS src
  ON tgt.event_date = src.event_date
  WHEN MATCHED THEN UPDATE SET ...
  WHEN NOT MATCHED THEN INSERT ...;

Task DAGs (Dependency Chains)

With Serverless Tasks, you can also build a DAG by defining task dependencies with the AFTER clause. Child tasks fire in order after the root task (the top-level task that has a SCHEDULE) finishes.

-- Root task (Serverless)
CREATE OR REPLACE TASK dag_root
  USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE = 'SMALL'
  SCHEDULE = 'USING CRON 0 3 * * * Asia/Tokyo'
AS
  INSERT INTO staging.raw_data
  SELECT * FROM external_table WHERE loaded = FALSE;

-- Child task 1 (Serverless)
CREATE OR REPLACE TASK dag_transform
  USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE = 'MEDIUM'
  AFTER dag_root
AS
  INSERT INTO analytics.transformed
  SELECT ... FROM staging.raw_data WHERE ...;

-- Child task 2 (Serverless)
CREATE OR REPLACE TASK dag_quality_check
  USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE = 'XSMALL'
  AFTER dag_transform
AS
  CALL quality_check_sp('analytics.transformed');

-- Start the DAG (RESUME from leaves to root)
ALTER TASK dag_quality_check RESUME;
ALTER TASK dag_transform RESUME;
ALTER TASK dag_root RESUME;

Privilege Design

To use Serverless Tasks, the task owner role must be granted the account-level EXECUTE MANAGED TASK privilege. This is a different privilege model from the USAGE ON WAREHOUSE privilege used by User-managed Tasks.

-- Privileges for Serverless Tasks
GRANT EXECUTE MANAGED TASK ON ACCOUNT
  TO ROLE etl_role;

-- Task creation privilege (common to Serverless and User-managed)
GRANT CREATE TASK ON SCHEMA analytics
  TO ROLE etl_role;

-- For User-managed Tasks you also need warehouse privileges
GRANT USAGE ON WAREHOUSE etl_warehouse
  TO ROLE etl_role;

Cost Estimation

Cost history for Serverless Tasks is available through the SNOWFLAKE.ACCOUNT_USAGE.SERVERLESS_TASK_HISTORY view. For User-managed Tasks, check WAREHOUSE_METERING_HISTORY instead.

-- Aggregate Serverless Task credit consumption by day
SELECT
  DATE_TRUNC('DAY', START_TIME) AS exec_date,
  TASK_NAME,
  COUNT(*) AS exec_count,
  SUM(CREDITS_USED) AS total_credits
FROM SNOWFLAKE.ACCOUNT_USAGE.SERVERLESS_TASK_HISTORY
WHERE START_TIME >= DATEADD('DAY', -30, CURRENT_TIMESTAMP())
GROUP BY exec_date, TASK_NAME
ORDER BY total_credits DESC;

-- Check task execution history
SELECT *
FROM TABLE(INFORMATION_SCHEMA.TASK_HISTORY(
  TASK_NAME => 'ETL_DAILY_AGGREGATE',
  SCHEDULED_TIME_RANGE_START => DATEADD('DAY', -7, CURRENT_TIMESTAMP())
))
ORDER BY SCHEDULED_TIME DESC;

Operational Monitoring

When a task fails, combine the ALERT feature with Notification Integrations to detect it. When TASK_HISTORY shows STATE = 'FAILED', identify the cause from ERROR_MESSAGE.

-- Extract recent failed tasks
SELECT
  NAME,
  SCHEDULED_TIME,
  STATE,
  ERROR_CODE,
  ERROR_MESSAGE
FROM TABLE(INFORMATION_SCHEMA.TASK_HISTORY(
  RESULT_LIMIT => 100
))
WHERE STATE = 'FAILED'
ORDER BY SCHEDULED_TIME DESC;

Key Exam Points

  • For Serverless Tasks, omit the WAREHOUSE clause and use USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE instead
  • Required privilege is EXECUTE MANAGED TASK ON ACCOUNT (different from User-managed's USAGE ON WAREHOUSE)
  • Billing characteristics: 1.5x Serverless Credit multiplier but zero idle cost
  • DAG construction via the AFTER clause works for both Serverless and User-managed tasks
  • Cost is tracked in the SERVERLESS_TASK_HISTORY view

Check with a Practice Question

SnowPro

問題 1

Which is the correct SQL syntax for creating a Serverless Task?

  1. CREATE TASK t1 WAREHOUSE = compute_wh USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE = 'SMALL' SCHEDULE = '5 MINUTE' AS SELECT 1;
  2. CREATE TASK t1 USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE = 'SMALL' SCHEDULE = '5 MINUTE' AS SELECT 1;
  3. CREATE TASK t1 SERVERLESS = TRUE WAREHOUSE_SIZE = 'SMALL' SCHEDULE = '5 MINUTE' AS SELECT 1;
  4. CREATE TASK t1 COMPUTE_POOL = serverless_pool SCHEDULE = '5 MINUTE' AS SELECT 1;

正解: B

For a Serverless Task you omit the WAREHOUSE clause and specify the initial compute size with USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE. You cannot specify WAREHOUSE and USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE together as in option A. SERVERLESS = TRUE and COMPUTE_POOL are not real parameters.

Frequently Asked Questions

Are Serverless Tasks more expensive than User-managed Tasks?

Serverless Tasks apply a 1.5x Serverless Credit multiplier, but they eliminate warehouse standby costs (idle time and the 60-second minimum billing on startup). For low-frequency tasks (e.g., once an hour with a 10-second runtime), Serverless usually has a lower total cost. Conversely, User-managed Tasks are typically cheaper for pipelines where batches run continuously. Use the SERVERLESS_TASK_HISTORY view to check credit consumption and decide.

What size should I choose for USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE?

This parameter is the initial compute size that a Serverless Task uses on its first run. You can specify XSMALL through XXLARGE, and Snowflake automatically adjusts the size based on subsequent execution history. Base the initial value on data volume: XSMALL-SMALL for INSERT/MERGE on a few million rows or less, and MEDIUM-LARGE for GROUP BY aggregation across billions of rows.

Can I build task DAGs with Serverless Tasks?

Yes. Just like regular tasks, you can define parent-child relationships with the AFTER keyword to build a DAG with Serverless Tasks. You can make the root task Serverless and mix Serverless and User-managed child tasks. As with User-managed Tasks, you set SCHEDULE on the root task and start the DAG with ALTER TASK ... RESUME.

Check what you learned with practice questions

Practice with certification-focused question sets

無料で問題を解いてみる
Author

NicheeLab Editorial Team

NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.


Related articles
Snowflake

Snowflake Certifications: All 11 Exams Explained (2026)

Every SnowPro certification — Associate, Core, Specialty, Ad...

Snowflake

Snowflake Exam Difficulty Ranking: All 11 Certs Compared (2026)

All 11 SnowPro exams ranked by difficulty with study-time es...

Snowflake

Snowflake Study Guide: Fastest Pass Route by Exam (2026)

How to pass SnowPro certifications efficiently — official ma...

Snowflake

SnowPro Core (COF-C03): Complete Exam Guide (2026)

Pass the SnowPro Core exam — six domains, scope, sample ques...

Snowflake

SnowPro Associate Platform (SOL-C01): Complete Guide (2026)

The entry-level SnowPro Associate exam — scope, weighting, s...

Browse all Snowflake articles (103)
© 2026 NicheeLab All rights reserved.