0% found this document useful (0 votes)
13 views7 pages

What Is Resource Monitor in Snowflake

The document provides an overview of Resource Monitors in Snowflake, emphasizing their role in cost management and credit usage monitoring for virtual warehouses. It includes SQL examples for creating and altering resource monitors at both warehouse and account levels, as well as scheduling options for daily, weekly, monthly, and yearly monitoring. Additionally, it addresses common questions regarding the functionality and administration of resource monitors.

Uploaded by

ksnyogatuni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views7 pages

What Is Resource Monitor in Snowflake

The document provides an overview of Resource Monitors in Snowflake, emphasizing their role in cost management and credit usage monitoring for virtual warehouses. It includes SQL examples for creating and altering resource monitors at both warehouse and account levels, as well as scheduling options for daily, weekly, monthly, and yearly monitoring. Additionally, it addresses common questions regarding the functionality and administration of resource monitors.

Uploaded by

ksnyogatuni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

What Is Resource Monitor In

Snowflake

Summary

1. Resource Monitor Introduction


2. SQL For Create Warehouse Level Resource Monitor
3. SQL For Create Account Level Resource Monitor
4. SQL For Alter Warehouse Level Resource Monitor
5. SQL For Resource Monitor with Daily Schedule
6. SQL For Resource Monitor with Monthly Schedule
7. SQL For Resource Monitor with Weekly Schedule
8. SQL For Resource Monitor with Yearly Schedule

What is resource monitor

Resource Monitor Introduction


We hardly talk about resource monitors and its role in snowflake, but there
are so much to cover when it comes to snowflake resource monitor, and
there is lack of good content in the web. In the pay-as-you go era, having a
good understanding about Resource Monitor is must.

Snowflake offers resource monitors as a means of assisting in cost


management and preventing unforeseen credit usage brought on by
operating warehouses. While it’s running, a virtual warehouse uses up
Snowflake credits.

A resource monitor can only suspend user-managed virtual warehouses


based on credit usage thresholds, but it can track credit usage by both user-
managed and virtual warehouses utilised by cloud services. After a user-
managed warehouse is suspended, credit consumption for cloud services
may still be allowed.

The amount of credits used is determined on the size and duration of the
warehouse.

Limits may be established for a certain timeframe or range of dates. The


resource monitor can cause a number of actions, such as issuing alarm alerts
and/or halting user-managed warehouses, when certain limitations are
reached and/or are approaching.

Only account administrators (i.e., users with the ACCOUNTADMIN role) are
able to establish resource monitors, but account administrators can decide to
allow users with other privileges to view and change resource monitors using
SQL.

Every database in an account that uses Snowflake has a schema called


INFORMATION SCHEMA that implements the Information Schema.

The power of Snowflake Information Schema is not well known and the
usefulness it brings to data developers and data ops engineers are not
discussed anywhere. (Watch complete video )

We have published a detailed video on resource monitor and this video is a


comprehensive & practical guide with hands-on excercise on snowflake
resource monitor. It will help you to answer the following questions
1. 🙋 Does resource monitor applicable only for a virtual warehouse
(compute)?
2. 🙋 Difference between account and warehouse level resource monitors?
3. 🙋 What is the role of frequency & trigger in resource monitors?
4. 🙋 How notification works for a resource monitor?
5. 🙋 Which role can create resource monitor objects in snowflake?
6. 🙋 Can multiple resource monitors be associated with a virtual
warehouse?
7. 🙋 What is a dormant resource monitor?
8. 🙋 What is “customised schedule” in a resource monitor?
9. 🙋 What are the different actions supported by resource monitor?
10. 🙋 What happens to virtual warehouse when suspend action is
triggered?

You can watch the complete hands on video tutorial on resource monitor
SQL For Create Warehouse Level
Resource Monitor
1 CREATE RESOURCE MONITOR "RM_1CREDIT_DAILY_WH_LEVEL" WITH CREDIT_QUOTA = 1
2 TRIGGERS
3 ON 95 PERCENT DO SUSPEND
4 ON 100 PERCENT DO SUSPEND_IMMEDIATE
5 ON 90 PERCENT DO NOTIFY
6 ON 85 PERCENT DO NOTIFY
7 ON 80 PERCENT DO NOTIFY
8 ON 75 PERCENT DO NOTIFY
9 ON 70 PERCENT DO NOTIFY;
10
11 ALTER WAREHOUSE "COMPUTE_WH" SET RESOURCE_MONITOR =
12 "RM_1CREDIT_DAILY_WH_LEVEL";
13

SQL For Create Account Level


Resource Monitor
1 CREATE RESOURCE MONITOR "ACCOUNT_LEVEL_RM" WITH CREDIT_QUOTA = 100
2 TRIGGERS
3 ON 100 PERCENT DO SUSPEND
4 ON 90 PERCENT DO SUSPEND_IMMEDIATE
5 ON 80 PERCENT DO NOTIFY
6 ON 70 PERCENT DO NOTIFY;
7 ALTER ACCOUNT SET RESOURCE_MONITOR = "ACCOUNT_LEVEL_RM";

SQL For Alter Warehouse Level


Resource Monitor
1 ALTER RESOURCE MONITOR "RM_1CREDIT_DAILY_WH_LEVEL" SET CREDIT_QUOTA = 1
2 TRIGGERS
3 ON 95 PERCENT DO SUSPEND
4 ON 100 PERCENT DO SUSPEND_IMMEDIATE
5 ON 80 PERCENT DO NOTIFY;

SQL For Resource Monitor with


Daily Schedule
1 CREATE RESOURCE MONITOR "WAREHOUSE_LEVEL_RM"
2 WITH CREDIT_QUOTA = 100,
3 frequency = 'DAILY',
4 start_timestamp = 'IMMEDIATELY',
5 end_timestamp = null
6 TRIGGERS
7 ON 95 PERCENT DO SUSPEND
8 ON 100 PERCENT DO SUSPEND_IMMEDIATE
9 ON 90 PERCENT DO NOTIFY
10 ON 85 PERCENT DO NOTIFY
11 ON 80 PERCENT DO NOTIFY;
12 ALTER WAREHOUSE "COMPUTE_WH" SET RESOURCE_MONITOR = "WAREHOUSE_LEVEL_RM";

SQL For Resource Monitor with


Monthly Schedule
1 CREATE RESOURCE MONITOR "WAREHOUSE_LEVEL_RM"
2 WITH CREDIT_QUOTA = 100,
3 frequency = 'MONTHLY',
4 start_timestamp = 'IMMEDIATELY',
5 end_timestamp = null
6 TRIGGERS
7 ON 95 PERCENT DO SUSPEND
8 ON 100 PERCENT DO SUSPEND_IMMEDIATE
9 ON 90 PERCENT DO NOTIFY
10 ON 85 PERCENT DO NOTIFY
11 ON 80 PERCENT DO NOTIFY;
12 ALTER WAREHOUSE "COMPUTE_WH" SET RESOURCE_MONITOR = "WAREHOUSE_LEVEL_RM";

SQL For Resource Monitor with


Weekly Schedule
1 CREATE RESOURCE MONITOR "WAREHOUSE_LEVEL_RM"
2 WITH CREDIT_QUOTA = 100,
3 frequency = 'WEEKLY',
4 start_timestamp = 'IMMEDIATELY',
5 end_timestamp = null
6 TRIGGERS
7 ON 95 PERCENT DO SUSPEND
8 ON 100 PERCENT DO SUSPEND_IMMEDIATE
9 ON 90 PERCENT DO NOTIFY
10 ON 85 PERCENT DO NOTIFY
11 ON 80 PERCENT DO NOTIFY;
12 ALTER WAREHOUSE "COMPUTE_WH" SET RESOURCE_MONITOR = "WAREHOUSE_LEVEL_RM";

SQL For Resource Monitor with


Yearly Schedule
1 CREATE RESOURCE MONITOR "WAREHOUSE_LEVEL_RM"
2 WITH CREDIT_QUOTA = 100,
3 frequency = 'YEARLY',
4 start_timestamp = 'IMMEDIATELY',
5 end_timestamp = null
6 TRIGGERS
7 ON 95 PERCENT DO SUSPEND
8 ON 100 PERCENT DO SUSPEND_IMMEDIATE
9 ON 90 PERCENT DO NOTIFY
10 ON 85 PERCENT DO NOTIFY
11 ON 80 PERCENT DO NOTIFY;
12 ALTER WAREHOUSE "COMPUTE_WH" SET RESOURCE_MONITOR = "WAREHOUSE_LEVEL_RM";

You might also like