0
0
Snowflakecloud~10 mins

Resource monitors for cost control in Snowflake - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Resource monitors for cost control
Create Resource Monitor
Set Credit Quota Limit
Assign to Warehouses
Monitor Usage
Check if Usage > Quota?
NoContinue Monitoring
Yes
Trigger Alert or Suspend Warehouse
Reset or Adjust Monitor
This flow shows how a resource monitor is created, assigned, and tracks usage to control costs by alerting or suspending warehouses when limits are exceeded.
Execution Sample
Snowflake
CREATE RESOURCE MONITOR my_monitor
  WITH CREDIT_QUOTA = 100
  TRIGGERS ON 90 PERCENT DO NOTIFY
  ON 100 PERCENT DO SUSPEND;
ALTER WAREHOUSE my_warehouse SET RESOURCE_MONITOR = my_monitor;
This code creates a resource monitor with a 100 credit limit and triggers notifications at 90% usage and suspends the warehouse at 100%, then assigns it to a warehouse.
Process Table
StepActionCredit UsageCondition CheckedResulting Action
1Create resource monitor with 100 credit quota0N/AMonitor created
2Assign monitor to warehouse0N/AWarehouse linked to monitor
3Warehouse runs queries, usage = 50 credits5050 < 90%Continue monitoring
4Warehouse usage reaches 90 credits9090% reachedSend notification alert
5Warehouse usage reaches 100 credits100100% reachedSuspend warehouse
6Warehouse suspended, usage reset or adjusted0Monitor reset or adjustedMonitoring continues
7Usage remains below quota3030 < 90%Continue monitoring
💡 Warehouse usage stays below quota or is suspended when 100% quota is reached
Status Tracker
VariableStartAfter Step 3After Step 4After Step 5After Step 6After Step 7
Credit Usage05090100030
Monitor StateCreatedActiveAlert SentWarehouse SuspendedResetActive
Key Moments - 3 Insights
Why does the warehouse get suspended at 100 credits usage?
Because the resource monitor is set to suspend the warehouse when usage reaches 100% of the quota, as shown in step 5 of the execution_table.
What happens when usage reaches 90 credits but not 100?
A notification alert is sent to warn about high usage, but the warehouse continues running, as shown in step 4.
Can the monitor usage reset after suspension?
Yes, after suspension, the monitor can be reset or adjusted to continue monitoring, as shown in step 6.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the credit usage when the notification alert is sent?
A90 credits
B100 credits
C50 credits
D30 credits
💡 Hint
Check step 4 in the execution_table where the alert is triggered.
At which step does the warehouse get suspended due to credit usage?
AStep 3
BStep 4
CStep 5
DStep 6
💡 Hint
Look for the step where the action is 'Suspend warehouse' in the execution_table.
If the credit quota was increased to 200, how would the suspension step change?
ASuspension would happen at 180 credits
BSuspension would happen at 200 credits
CSuspension would happen at 100 credits
DSuspension would never happen
💡 Hint
Suspension happens at 100% of the quota, so check the quota value in the variable_tracker.
Concept Snapshot
Resource monitors track credit usage to control Snowflake costs.
Set a credit quota limit and assign the monitor to warehouses.
Triggers can notify or suspend warehouses at usage thresholds.
Monitor usage continuously and act when limits are reached.
Reset or adjust monitors after suspension to continue control.
Full Transcript
Resource monitors in Snowflake help control costs by tracking how many credits warehouses use. First, you create a resource monitor with a credit quota limit, like 100 credits. Then, you assign this monitor to one or more warehouses. As the warehouse runs queries, the monitor tracks credit usage. When usage reaches 90% of the quota, it sends a notification alert. If usage hits 100%, the monitor suspends the warehouse to stop further costs. After suspension, the monitor can be reset or adjusted to continue monitoring. This process helps keep cloud costs predictable and controlled.