Credit usage in Snowflake measures the amount of compute resources consumed. Credits are used when warehouses run queries or perform tasks.
Click to reveal answer
beginner
How can you check credit usage for your Snowflake account?
You can query the ACCOUNT_USAGE schema, especially the WAREHOUSE_METERING_HISTORY view, to see credit usage details over time.
Click to reveal answer
intermediate
What SQL command shows credit usage for warehouses in the last 7 days?
SELECT WAREHOUSE_NAME, SUM(CREDITS_USED) AS TOTAL_CREDITS FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY WHERE START_TIME >= DATEADD(day, -7, CURRENT_TIMESTAMP()) GROUP BY WAREHOUSE_NAME;
Click to reveal answer
beginner
Why is monitoring credit usage important in Snowflake?
Monitoring credit usage helps control costs, optimize warehouse sizes, and avoid unexpected charges by understanding resource consumption.
Click to reveal answer
intermediate
What is a practical way to automate credit usage alerts in Snowflake?
You can create scheduled tasks that query credit usage and send notifications (e.g., email) when usage exceeds thresholds.
Click to reveal answer
Which Snowflake view provides detailed credit usage per warehouse?
AWAREHOUSE_METERING_HISTORY
BQUERY_HISTORY
CLOGIN_HISTORY
DDATABASE_STORAGE_USAGE_HISTORY
✗ Incorrect
The WAREHOUSE_METERING_HISTORY view shows credit usage details for warehouses.
What does one Snowflake credit represent?
AOne user login session
BOne gigabyte of data stored
COne hour of compute usage on a single credit unit warehouse
DOne query executed
✗ Incorrect
One credit equals one hour of compute on a 1-credit warehouse.
Which SQL function helps calculate credit usage over the last 30 days?
ADATEADD
BDATEDIFF
CCURRENT_DATE
DTO_TIMESTAMP
✗ Incorrect
DATEADD is used to subtract days from the current date to filter recent usage.
Why should you monitor credit usage regularly?
ATo create more warehouses
BTo avoid unexpected billing and optimize resource use
CTo backup data faster
DTo increase query speed automatically
✗ Incorrect
Regular monitoring helps control costs and optimize warehouse performance.
What Snowflake feature can automate credit usage checks?
AStreams
BExternal Functions
CMaterialized Views
DScheduled Tasks
✗ Incorrect
Scheduled Tasks can run queries periodically to monitor credit usage.
Explain how to monitor credit usage in Snowflake using SQL queries.
Think about querying usage history and grouping data.
You got /4 concepts.
Describe why monitoring credit usage is important and how automation can help.
Consider cost management and proactive notifications.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of monitoring credit usage in Snowflake?
easy
A. To control and optimize Snowflake costs
B. To increase the number of warehouses automatically
C. To backup data to external storage
D. To improve query performance by caching
Solution
Step 1: Understand credit usage concept
Credit usage monitoring tracks how many credits Snowflake consumes, which directly affects billing.
Step 2: Identify the goal of monitoring
The goal is to control and optimize costs by understanding usage patterns.
Final Answer:
To control and optimize Snowflake costs -> Option A
Confusing credit monitoring with performance tuning
Thinking it automatically scales warehouses
Assuming it backs up data
2. Which Snowflake view provides detailed credit usage information for warehouses?
easy
A. INFORMATION_SCHEMA.TABLES
B. ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
C. ACCOUNT_USAGE.LOGIN_HISTORY
D. SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
Solution
Step 1: Identify views related to credit usage
ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY tracks credit consumption by warehouses.
Step 2: Exclude unrelated views
INFORMATION_SCHEMA.TABLES shows table info, LOGIN_HISTORY tracks logins, QUERY_HISTORY tracks queries but not credit usage.
Final Answer:
ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY -> Option B
Quick Check:
Warehouse credit data = WAREHOUSE_METERING_HISTORY [OK]
Hint: Warehouse credit data is in WAREHOUSE_METERING_HISTORY view [OK]
Common Mistakes:
Choosing QUERY_HISTORY which tracks queries, not credits
Confusing LOGIN_HISTORY with credit usage
Selecting INFORMATION_SCHEMA views unrelated to credits
3. What will the following query return?
SELECT WAREHOUSE_NAME, SUM(CREDITS_USED) AS TOTAL_CREDITS FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY GROUP BY WAREHOUSE_NAME ORDER BY TOTAL_CREDITS DESC;
medium
A. List of warehouses with their current running queries
B. Total credits used by each user in the account
C. Total credits used by each warehouse, sorted from highest to lowest
D. A syntax error due to missing WHERE clause
Solution
Step 1: Analyze the SELECT and GROUP BY
The query sums credits used grouped by warehouse name.
Step 2: Understand ORDER BY clause
Ordering by TOTAL_CREDITS DESC sorts warehouses from highest to lowest credit usage.
Final Answer:
Total credits used by each warehouse, sorted from highest to lowest -> Option C
Quick Check:
SUM credits by warehouse, ordered DESC = Total credits used by each warehouse, sorted from highest to lowest [OK]
Hint: GROUP BY warehouse sums credits; ORDER BY DESC sorts high to low [OK]
Common Mistakes:
Thinking it shows user credit usage
Assuming it lists running queries
Believing missing WHERE causes syntax error
4. You run this query but get no results:
SELECT WAREHOUSE_NAME, SUM(CREDITS_USED) FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY WHERE START_TIME > CURRENT_DATE() GROUP BY WAREHOUSE_NAME;
What is the likely cause?
medium
A. Missing GROUP BY clause
B. Syntax error due to missing alias for SUM
C. Incorrect table name used
D. No credit usage recorded today yet
Solution
Step 1: Check the WHERE condition
Filtering START_TIME > CURRENT_DATE() means only today's data is shown.
Step 2: Consider data availability
If no credits used today yet, query returns empty result, not error.
Final Answer:
No credit usage recorded today yet -> Option D
Quick Check:
Empty result = no data matching date filter [OK]
Hint: Empty results often mean no data matches the filter [OK]
Common Mistakes:
Assuming missing alias causes error
Thinking table name is wrong
Believing GROUP BY is missing
5. You want to monitor credit usage by service type (e.g., WAREHOUSE, CLOUD_SERVICES) for the last 7 days. Which query correctly achieves this?
hard
A. SELECT SERVICE_TYPE, SUM(CREDITS_USED) AS TOTAL_CREDITS FROM SNOWFLAKE.ACCOUNT_USAGE.METERING_HISTORY WHERE START_TIME >= DATEADD(day, -7, CURRENT_DATE()) GROUP BY SERVICE_TYPE ORDER BY TOTAL_CREDITS DESC;
B. SELECT SERVICE_TYPE, SUM(CREDITS_USED) FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY WHERE START_TIME >= DATEADD(day, -7, CURRENT_DATE()) GROUP BY SERVICE_TYPE;
C. SELECT WAREHOUSE_NAME, SUM(CREDITS_USED) FROM SNOWFLAKE.ACCOUNT_USAGE.METERING_HISTORY WHERE START_TIME >= DATEADD(day, -7, CURRENT_DATE()) GROUP BY WAREHOUSE_NAME;
D. SELECT SERVICE_TYPE, CREDITS_USED FROM SNOWFLAKE.ACCOUNT_USAGE.METERING_HISTORY WHERE START_TIME >= DATEADD(day, -7, CURRENT_DATE());
Solution
Step 1: Identify correct view for service type credit data
ACCOUNT_USAGE.METERING_HISTORY contains credit usage by service type; WAREHOUSE_METERING_HISTORY is only for warehouses.
Step 2: Check query filters and grouping
Filtering last 7 days with DATEADD and grouping by SERVICE_TYPE is correct; ordering by total credits helps see highest usage.
Final Answer:
SELECT SERVICE_TYPE, SUM(CREDITS_USED) AS TOTAL_CREDITS FROM SNOWFLAKE.ACCOUNT_USAGE.METERING_HISTORY WHERE START_TIME >= DATEADD(day, -7, CURRENT_DATE()) GROUP BY SERVICE_TYPE ORDER BY TOTAL_CREDITS DESC; -> Option A
Quick Check:
Use METERING_HISTORY + SERVICE_TYPE + last 7 days = SELECT SERVICE_TYPE, SUM(CREDITS_USED) AS TOTAL_CREDITS FROM SNOWFLAKE.ACCOUNT_USAGE.METERING_HISTORY WHERE START_TIME >= DATEADD(day, -7, CURRENT_DATE()) GROUP BY SERVICE_TYPE ORDER BY TOTAL_CREDITS DESC; [OK]
Hint: Use METERING_HISTORY view and group by SERVICE_TYPE for service credit usage [OK]
Common Mistakes:
Using WAREHOUSE_METERING_HISTORY for service types
Not grouping by SERVICE_TYPE
Selecting credits without aggregation
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.