Reputation: 5295
I'm curious about the usage/credits/cost implications of resuming & suspending a warehouse multiple times within one minute (whether this happens manually or automatically).
The Snowflake documentation is slightly ambiguous regarding this edge case.
From Virtual Warehouse Credit Usage:
The credit numbers shown here are for a full hour of usage; however, credits are billed per-second, with a 60-second (i.e. 1-minute) minimum:
- Each time a warehouse is started or resized to a larger size, the warehouse is billed for 1 minute’s worth of usage based on the hourly rate shown above.
- Stopping and restarting a warehouse within the first minute does not change the amount billed; the minimum billing charge is 1 minute.
From How are Credits Charged for Warehouses?:
When warehouses are provisioned:
- The minimum billing charge for provisioning a warehouse is 1 minute (i.e. 60 seconds).
- There is no benefit to stopping a warehouse before the first 60-second period is over because the credits have already been billed for that period.
- After the first 60 seconds, all subsequent billing for a running warehouse (until it is shut down). Three examples are provided below:
- If a warehouse runs for 30 to 60 seconds, it is billed for 60 seconds.
- If a warehouse runs for 61 seconds, it is billed for only 61 seconds.
- If a warehouse runs for 61 seconds, shuts down, and then restarts and runs for less than 60 seconds, it is billed for 121 seconds (60 + 1 + 60).
What I'm looking for would be an example along the lines of:
I assume it is the latter, but I would like to know for sure.
Upvotes: 1
Views: 562
Reputation: 5295
Just ran some tests, and the results are clear:
Each restart of a warehouse (no matter the context or when it was last suspended), will incur the 60 seconds minimum charge.
I tested with a Medium warehouse (4/60 credits per minute):
Upvotes: 1
Reputation: 26078
create warehouse timetest2 WAREHOUSE_SIZE = XSMALL INITIALLY_SUSPENDED = TRUE;
use warehouse timetest2;
alter warehouse timetest2 RESUME;
select sum(random())
from table(generator(TIMELIMIT => 10));
alter warehouse timetest2 SUSPEND;
with the last three steps done twice, with 5 seconds of pause.
select start_time,
warehouse_name,
credits_used_compute,
round(credits_used_compute * 60,3) as minutes_billed
from table(information_schema.warehouse_metering_history(dateadd('hour',-1,current_timestamp)));
START_TIME | WAREHOUSE_NAME | CREDITS_USED_COMPUTE | MINUTES_BILLED |
---|---|---|---|
2022-04-16 15:32:36.000 -0700 | TIMETEST2 | 0.033333333 | 2 |
2022-04-16 15:32:36.000 -0700 | TIMETEST | 0.033333333 | 2 |
Done twice, just incase as the first was sloppy. It seems to bill per minute as noted.
Upvotes: 2