danD
danD

Reputation: 716

Snowflake Task cost estimation

I have a generic question about Snowflake Cost Estimation. I have a task which is schedule to execute every 5 min

CREATE TASK mytask1
  WAREHOUSE = mywh
  SCHEDULE = '5 minute'
WHEN
  SYSTEM$STREAM_HAS_DATA('MYSTREAM')
AS
  INSERT INTO ... ;

In case if there is no new data in mystream, In that case the task will be skipped. However will it be costing any money as the task is still runinng.

Please suggest

Upvotes: 0

Views: 2995

Answers (2)

Lukasz Szozda
Lukasz Szozda

Reputation: 175596

CREATE TASK:

SYSTEM$STREAM_HAS_DATA

Validating the conditions of the WHEN expression does not require a virtual warehouse. The validation is instead processed in the cloud services layer. A nominal charge accrues each time a task evaluates its WHEN condition and does not run. The charges accumulate each time the task is triggered until it runs. At that time, the charge is converted to Snowflake credits and added to the compute resource usage for the task run.

Generally the compute time to validate the condition is insignificant compared to task execution time. As a best practice, align scheduled and actual task runs as closely as possible. Avoid task schedules that are wildly out of synch with actual task runs. For example, if data is inserted into a table with a stream roughly every 24 hours, do not schedule a task that checks for stream data every minute. The charge to validate the WHEN expression with each run is generally insignificant, but the charges are cumulative.

Note that daily consumption of cloud services that falls below the 10% quota of the daily usage of the compute resources accumulates no cloud services charges.

Upvotes: 1

Mike Walton
Mike Walton

Reputation: 7339

The only possible cost is a Cloud Services cost for the metadata check to see if the stream has data. Based on how Cloud Services credits are discounted, there is a really good chance that this will never be something you'll see a charge for. You can read up on the cloud services billing here:

https://docs.snowflake.com/en/user-guide/credits.html#cloud-services-credit-usage

Upvotes: 1

Related Questions