Database / Snowflake Interview Questions
What is Resource Monitor in Snowflake and how do you use it to control credit consumption?
A Resource Monitor is a named Snowflake object that watches credit consumption for one or more Virtual Warehouses (or the entire account) and automatically takes action when configurable thresholds are crossed. It is the primary guardrail against runaway warehouse spend — for example, preventing a poorly-written query or a forgotten warehouse from consuming an entire month's budget.
A Resource Monitor defines a credit quota (the total credits allowed within the reset period) and one or more threshold triggers (expressed as percentages of the quota). Each trigger has an action:
NOTIFY— sends an email alert to the monitor's notification list but takes no action against the warehouse.SUSPEND— suspends the warehouse after all currently running queries complete.SUSPEND_IMMEDIATE— immediately kills all running queries and suspends the warehouse without waiting.
Reset schedule: DAILY, WEEKLY, MONTHLY, or YEARLY — the quota resets on this cadence. Monitors can be set at account level (applies to all warehouses) or assigned to individual warehouses.
-- Create a Resource Monitor: 500 credits/month, suspend at 90%, alert at 75%
CREATE RESOURCE MONITOR monthly_budget
CREDIT_QUOTA = 500
FREQUENCY = MONTHLY
START_TIMESTAMP = IMMEDIATELY
TRIGGERS
ON 75 PERCENT DO NOTIFY
ON 90 PERCENT DO SUSPEND
ON 100 PERCENT DO SUSPEND_IMMEDIATE;
-- Attach the monitor to a specific warehouse
ALTER WAREHOUSE reporting_wh SET RESOURCE_MONITOR = monthly_budget;
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
