Bird
Raised Fist0
Snowflakecloud~20 mins

Credit usage monitoring in Snowflake - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Credit Usage Monitoring Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Querying total credits used by a Snowflake warehouse
What is the output of this query that sums the credits used by warehouse 'COMPUTE_WH' in the last 7 days?
Snowflake
SELECT SUM(CREDITS_USED) AS TOTAL_CREDITS
FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
WHERE WAREHOUSE_NAME = 'COMPUTE_WH'
AND START_TIME >= DATEADD(day, -7, CURRENT_TIMESTAMP());
AAn empty result because START_TIME filter is invalid
BMultiple rows listing credits used per day for COMPUTE_WH in the last 7 days
CAn error because WAREHOUSE_NAME is case sensitive and should be lowercase
DA single row with TOTAL_CREDITS showing the sum of credits used in the last 7 days for COMPUTE_WH
Attempts:
2 left
💡 Hint
Check the aggregation and filtering by warehouse and date range.
🧠 Conceptual
intermediate
1:30remaining
Understanding Snowflake credit billing granularity
Which statement correctly describes how Snowflake bills credits for warehouses?
ACredits are billed per second with a minimum of 60 seconds per warehouse usage
BCredits are billed per query executed regardless of warehouse size
CCredits are billed per hour regardless of actual usage time
DCredits are billed only when data is stored, not when warehouses run
Attempts:
2 left
💡 Hint
Think about how Snowflake charges for compute time.
❓ Troubleshoot
advanced
2:00remaining
Diagnosing missing credit usage data in ACCOUNT_USAGE
You run this query to check credit usage but get no rows returned: SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY WHERE START_TIME > CURRENT_DATE - 1; What is the most likely reason?
AThe warehouse has not used any credits in the last day, so no data exists
BThe query syntax is invalid because CURRENT_DATE cannot be used in WHERE clause
CThe ACCOUNT_USAGE views have a latency of up to 45 minutes, so recent data may not appear yet
DThe user running the query lacks privileges to see ACCOUNT_USAGE data
Attempts:
2 left
💡 Hint
Consider data availability delays in Snowflake's monitoring views.
🔀 Workflow
advanced
2:30remaining
Automating credit usage alerts with Snowflake tasks
Which sequence correctly describes how to automate daily credit usage alerts using Snowflake tasks and notifications?
A3,1,2,4
B1,2,3,4
C2,1,3,4
D1,3,2,4
Attempts:
2 left
💡 Hint
Think about the logical order of creating queries, scheduling, storing, and notifying.
✅ Best Practice
expert
3:00remaining
Optimizing credit usage monitoring for cost control
Which approach best helps minimize credit usage while maintaining accurate monitoring of warehouse consumption?
ASchedule credit usage queries to run hourly and aggregate results daily to reduce query frequency
BRun credit usage queries continuously every minute for real-time accuracy
CDisable warehouse metering history to save storage costs
DUse manual ad-hoc queries only when billing issues arise
Attempts:
2 left
💡 Hint
Balance monitoring frequency with cost impact.

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

  1. Step 1: Understand credit usage concept

    Credit usage monitoring tracks how many credits Snowflake consumes, which directly affects billing.
  2. Step 2: Identify the goal of monitoring

    The goal is to control and optimize costs by understanding usage patterns.
  3. Final Answer:

    To control and optimize Snowflake costs -> Option A
  4. Quick Check:

    Credit monitoring = Cost control [OK]
Hint: Credit usage monitoring helps manage costs effectively [OK]
Common Mistakes:
  • 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

  1. Step 1: Identify views related to credit usage

    ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY tracks credit consumption by warehouses.
  2. Step 2: Exclude unrelated views

    INFORMATION_SCHEMA.TABLES shows table info, LOGIN_HISTORY tracks logins, QUERY_HISTORY tracks queries but not credit usage.
  3. Final Answer:

    ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY -> Option B
  4. 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

  1. Step 1: Analyze the SELECT and GROUP BY

    The query sums credits used grouped by warehouse name.
  2. Step 2: Understand ORDER BY clause

    Ordering by TOTAL_CREDITS DESC sorts warehouses from highest to lowest credit usage.
  3. Final Answer:

    Total credits used by each warehouse, sorted from highest to lowest -> Option C
  4. 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

  1. Step 1: Check the WHERE condition

    Filtering START_TIME > CURRENT_DATE() means only today's data is shown.
  2. Step 2: Consider data availability

    If no credits used today yet, query returns empty result, not error.
  3. Final Answer:

    No credit usage recorded today yet -> Option D
  4. 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

  1. 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.
  2. 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.
  3. 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
  4. 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 unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard