💳 Credit Usage Reporting in Snowflake
Snowflake’s pay-as-you-go model charges based on credit consumption for compute and storage. Tracking and managing credit usage is key for cost control, budgeting, and ensuring project accountability.
What is it?
Credit usage reporting involves tracking how many credits are consumed over time, by which users/warehouses, and for which tasks.
Snowflake provides several built-in views and tables that give you this insight.
Why is it important?
- ✅ Cost control: Prevent budget overruns.
- ✅ Transparency: Know which teams/projects consume the most resources.
- ✅ Optimization: Identify opportunities to right-size workloads.
- ✅ Forecasting: Plan for future spend based on usage trends.
Key System Views & SQL Examples
1️⃣ Warehouse-level Credit Usage
Snowflake logs usage in the WAREHOUSE_METERING_HISTORY view.
SELECT
WAREHOUSE_NAME,
SUM(CREDITS_USED) AS TOTAL_CREDITS,
DATE_TRUNC('day', START_TIME) AS USAGE_DAY
FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
WHERE START_TIME >= DATEADD('day', -30, CURRENT_DATE())
GROUP BY WAREHOUSE_NAME, USAGE_DAY
ORDER BY USAGE_DAY DESC;
2️⃣ Daily Account-level Usage
Get daily breakdown of credits by service type (compute, cloud services, etc.).
SELECT
USAGE_DATE,
SERVICE_TYPE,
SUM(CREDITS_USED) AS TOTAL_CREDITS
FROM SNOWFLAKE.ACCOUNT_USAGE.METERING_DAILY_HISTORY
WHERE USAGE_DATE >= DATEADD('day', -30, CURRENT_DATE())
GROUP BY USAGE_DATE, SERVICE_TYPE
ORDER BY USAGE_DATE DESC;
3️⃣ Query-level Usage
See credits consumed by specific queries (in combination with Query History).
SELECT
QUERY_ID,
USER_NAME,
WAREHOUSE_NAME,
CREDITS_USED_CLOUD_SERVICES,
EXECUTION_TIME,
START_TIME
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE START_TIME >= DATEADD('day', -7, CURRENT_DATE())
ORDER BY START_TIME DESC;
Use Case
🔎 Finance Team: Wants to see which projects are burning the most credits to allocate costs accordingly.
💻 Data Engineering: Analyzes credit usage by warehouse to decide if scaling down (smaller size) or suspending faster can save money.
Best Practices
- ✅ Automate reporting: Use scheduled tasks to run the above queries and deliver usage dashboards.
- ✅ Set up Resource Monitors to cap usage and alert on thresholds.
CREATE RESOURCE MONITOR my_monitor
WITH CREDIT_QUOTA = 100
TRIGGERS ON 90 PERCENT DO NOTIFY
ON 100 PERCENT DO SUSPEND;
- ✅ Review regularly: Monthly reviews help spot trends and justify scaling decisions.
Limitations
⚠️ ACCOUNT_USAGE views can have latency of up to 45 minutes.
⚠️ Not real-time—use ORGANIZATION_USAGE or INFORMATION_SCHEMA for faster but more granular insights.
Advantages
- ✅ Transparent cost tracking
- ✅ Supports detailed drill-down by project, team, or warehouse
- ✅ Enables proactive budgeting and forecasting
Disadvantages
❌ Can require custom reporting/automation to fit organizational needs ❌ Historical usage data can be retained for up to 1 year—not forever.
Roles Required
To access these views, users need the MONITOR privilege or higher (e.g., ACCOUNTADMIN, SECURITYADMIN, or a custom role with usage grants).
Impact on Performance Tuning
💡 Credit usage reporting doesn’t directly affect performance, but insights can drive performance tuning:
- Identify expensive warehouses and queries → Optimize workloads.
- Detect warehouses left running without need → Adjust auto-suspend.
- Spot idle warehouses and consolidate workloads.
📌 Summary
Credit usage reporting ensures cost-effective use of Snowflake resources by:
- Providing transparency for better cost control.
- Enabling proactive optimization and right-sizing.
- Supporting governance and accountability.