Home Database Monitoring: Account Usage, Query History & Observability
Advanced 3 min · July 17, 2026

Monitoring: Account Usage, Query History & Observability

Master Snowflake monitoring with account usage views, query history, and observability best practices.

N
Naren Founder & Principal Engineer

20+ years shipping high-throughput database systems. Drawn from code that ran under real load.

Follow
Production
production tested
July 17, 2026
last updated
2,439
articles · all by Naren
Before you start⏱ 15-20 min read
  • Basic knowledge of SQL (SELECT, WHERE, GROUP BY, ORDER BY).
  • Access to a Snowflake account with ACCOUNTADMIN or MONITOR USAGE privilege.
  • Familiarity with Snowflake warehouses and databases.
 ● Production Incident 🔎 Debug Guide ⚙ Triage Commands
Quick Answer
  • Snowflake provides built-in views like SNOWFLAKE.ACCOUNT_USAGE and INFORMATION_SCHEMA.QUERY_HISTORY for monitoring.
  • Use QUERY_HISTORY to analyze past queries, identify slow queries, and track resource consumption.
  • Account usage views offer aggregated metrics on storage, credits, and login history.
  • Set up alerts and dashboards using Snowflake's observability features or third-party tools.
  • Monitor warehouse usage, concurrency, and data transfer to optimize costs and performance.
✦ Definition~90s read
What is Monitoring?

Snowflake monitoring is the practice of using built-in views and tools to track query performance, resource consumption, and account activity to optimize cost and performance.

Think of Snowflake as a giant library where each book is a piece of data.
Plain-English First

Think of Snowflake as a giant library where each book is a piece of data. Monitoring is like having a librarian who tracks which books are read most, how long people spend reading, and whether any books are being damaged. You can see who entered the library, what they read, and how much energy (credits) the lights and heating used. This helps you decide if you need more librarians (warehouses) or if some books should be moved to a cheaper shelf.

In the world of cloud data warehousing, Snowflake has emerged as a powerhouse, offering near-infinite scalability and a unique architecture that separates storage and compute. But with great power comes great responsibility—and cost. Without proper monitoring, your Snowflake account can quickly become a black hole for credits, with runaway queries and idle warehouses burning through your budget. This is where Snowflake's built-in observability features come to the rescue.

Snowflake provides a rich set of views and functions under the SNOWFLAKE.ACCOUNT_USAGE schema and INFORMATION_SCHEMA that give you unprecedented visibility into your account's health, performance, and usage patterns. Whether you're a data engineer trying to optimize a slow ETL pipeline, a platform admin tracking cost allocation across teams, or a developer debugging a sudden spike in query latency, these tools are indispensable.

In this tutorial, you'll learn how to query account usage views to monitor storage, credits, and login history. You'll dive deep into query history to identify slow or expensive queries, understand warehouse utilization, and set up proactive alerts. We'll also cover real-world debugging scenarios, including a production incident where a missing warehouse led to a major outage. By the end, you'll have a production-ready monitoring toolkit to keep your Snowflake environment running smoothly and cost-effectively.

Introduction to Snowflake Monitoring Views

Snowflake exposes several system-defined schemas that provide comprehensive monitoring data. The two most important are:

  • SNOWFLAKE.ACCOUNT_USAGE: Contains views with aggregated historical data (up to 365 days) for storage, credits, queries, logins, and more. Data is typically delayed by up to 2 hours.
  • INFORMATION_SCHEMA: Contains views like QUERY_HISTORY that provide near real-time data (usually within minutes) for the current session or account.
Key views include
  • QUERY_HISTORY: Details of all queries executed.
  • WAREHOUSE_METERING_HISTORY: Credit consumption per warehouse.
  • STORAGE_USAGE: Storage usage per database.
  • LOGIN_HISTORY: Successful and failed login attempts.
  • SESSIONS: Active sessions.

To access these views, you need the appropriate privileges (e.g., MONITOR USAGE on the account). Let's start by exploring the account usage schema.

explore_views.sqlSQL
1
2
3
4
5
-- List all views in SNOWFLAKE.ACCOUNT_USAGE
SELECT view_name FROM SNOWFLAKE.ACCOUNT_USAGE.VIEWS;

-- Check the definition of a specific view
DESCRIBE VIEW SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY;
Output
+------------------------------------+
| VIEW_NAME |
+------------------------------------+
| ACCESS_HISTORY |
| AUTOMATIC_CLUSTERING_HISTORY |
| DATABASE_STORAGE_USAGE_HISTORY |
| LOGIN_HISTORY |
| QUERY_HISTORY |
| SESSIONS |
| STORAGE_USAGE |
| WAREHOUSE_METERING_HISTORY |
| ... |
+------------------------------------+
🔥Data Latency
📊 Production Insight
Always consider data latency when building dashboards. For alerting on recent anomalies, use INFORMATION_SCHEMA; for trend analysis, use ACCOUNT_USAGE.
🎯 Key Takeaway
Snowflake provides two main schemas for monitoring: ACCOUNT_USAGE (historical, delayed) and INFORMATION_SCHEMA (near real-time).

Querying Query History for Performance Analysis

The QUERY_HISTORY view is your go-to for understanding what queries are running, how long they take, and how many resources they consume. You can filter by time range, warehouse, user, and more. Key columns include:

  • QUERY_ID: Unique identifier.
  • QUERY_TEXT: The SQL executed.
  • EXECUTION_TIME: Time in milliseconds.
  • BYTES_SCANNED: Amount of data read.
  • CREDITS_USED: Credits consumed (for serverless features).
  • WAREHOUSE_NAME: Warehouse used.
  • START_TIME, END_TIME.

Let's find the top 10 slowest queries in the last 24 hours.

slow_queries.sqlSQL
1
2
3
4
5
6
7
8
9
10
11
12
-- Top 10 slowest queries in the last 24 hours
SELECT
  query_id,
  query_text,
  execution_time / 1000 AS execution_seconds,
  bytes_scanned,
  warehouse_name,
  start_time
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE start_time >= DATEADD('day', -1, CURRENT_TIMESTAMP())
ORDER BY execution_time DESC
LIMIT 10;
Output
+--------------------------------------+------------------------------------------+-------------------+--------------+----------------+---------------------------+
| QUERY_ID | QUERY_TEXT | EXECUTION_SECONDS | BYTES_SCANNED | WAREHOUSE_NAME | START_TIME |
+--------------------------------------+------------------------------------------+-------------------+--------------+----------------+---------------------------+
| 0192a3b4-0501-1234-0000-000000000001 | SELECT * FROM large_table WHERE ... | 120.5 | 1073741824 | ANALYTICS_WH | 2025-03-15 10:00:00.000 |
| ... | ... | ... | ... | ... | ... |
+--------------------------------------+------------------------------------------+-------------------+--------------+----------------+---------------------------+
💡Filtering by User or Warehouse
📊 Production Insight
Large BYTES_SCANNED with high EXECUTION_TIME often indicates missing filters or full table scans. Consider clustering or partitioning.
🎯 Key Takeaway
Use QUERY_HISTORY to identify slow queries by execution time and bytes scanned.

Monitoring Warehouse Credit Consumption

Warehouses consume credits based on their size and runtime. The WAREHOUSE_METERING_HISTORY view provides hourly credit usage per warehouse. You can use this to track costs and identify idle warehouses. Let's see which warehouses consumed the most credits yesterday.

warehouse_credits.sqlSQL
1
2
3
4
5
6
7
8
9
10
-- Credit consumption by warehouse for yesterday
SELECT
  warehouse_name,
  SUM(credits_used) AS total_credits,
  COUNT(*) AS hours_active
FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
WHERE start_time >= DATEADD('day', -1, CURRENT_TIMESTAMP())
  AND start_time < DATEADD('day', 0, CURRENT_TIMESTAMP())
GROUP BY warehouse_name
ORDER BY total_credits DESC;
Output
+----------------+---------------+-------------+
| WAREHOUSE_NAME | TOTAL_CREDITS | HOURS_ACTIVE |
+----------------+---------------+-------------+
| ANALYTICS_WH | 24.5 | 24 |
| LOADING_WH | 12.0 | 12 |
| DEV_WH | 3.2 | 8 |
+----------------+---------------+-------------+
⚠ Idle Warehouse Detection
📊 Production Insight
Set up a daily job that alerts if any warehouse consumed more than a threshold (e.g., 100 credits) in a day.
🎯 Key Takeaway
WAREHOUSE_METERING_HISTORY helps track credit usage per warehouse and detect anomalies.

Tracking Storage Usage and Growth

Storage costs can sneak up on you. The STORAGE_USAGE view shows the average daily storage (in bytes) for each database, including compressed data, fail-safe, and time travel. Use DATABASE_STORAGE_USAGE_HISTORY for historical trends. Let's find the top 5 databases by storage.

storage_usage.sqlSQL
1
2
3
4
5
6
7
-- Top 5 databases by storage today
SELECT
  database_name,
  average_storage_bytes / 1099511627776 AS storage_tb
FROM SNOWFLAKE.ACCOUNT_USAGE.STORAGE_USAGE
ORDER BY average_storage_bytes DESC
LIMIT 5;
Output
+---------------+-----------+
| DATABASE_NAME | STORAGE_TB |
+---------------+-----------+
| PROD_DB | 2.5 |
| ANALYTICS_DB | 1.2 |
| STAGING_DB | 0.8 |
| DEV_DB | 0.3 |
| LOGS_DB | 0.1 |
+---------------+-----------+
🔥Time Travel and Fail-safe
📊 Production Insight
If a database's storage grows suddenly, check for large clones or materialized views. Use TABLE_STORAGE_METRICS to drill down.
🎯 Key Takeaway
Monitor storage per database to identify unexpected growth and manage costs.

Analyzing Login and Session History

Security and access monitoring are critical. LOGIN_HISTORY records all login attempts (success/failure), while SESSIONS shows currently active sessions. Use these to detect unauthorized access or troubleshoot connection issues. Let's find failed login attempts in the last week.

login_history.sqlSQL
1
2
3
4
5
6
7
8
9
10
11
-- Failed login attempts in the last 7 days
SELECT
  user_name,
  client_ip,
  first_authentication_method,
  error_message,
  event_timestamp
FROM SNOWFLAKE.ACCOUNT_USAGE.LOGIN_HISTORY
WHERE is_success = 'NO'
  AND event_timestamp >= DATEADD('day', -7, CURRENT_TIMESTAMP())
ORDER BY event_timestamp DESC;
Output
+-----------+--------------+---------------------------+----------------------------------+---------------------------+
| USER_NAME | CLIENT_IP | FIRST_AUTHENTICATION_METHOD | ERROR_MESSAGE | EVENT_TIMESTAMP |
+-----------+--------------+---------------------------+----------------------------------+---------------------------+
| JDOE | 192.168.1.10 | PASSWORD | INCORRECT_PASSWORD | 2025-03-14 15:30:00.000 |
| ... | ... | ... | ... | ... |
+-----------+--------------+---------------------------+----------------------------------+---------------------------+
⚠ Brute Force Detection
📊 Production Insight
Set up alerts for >5 failed logins from the same IP within an hour.
🎯 Key Takeaway
LOGIN_HISTORY helps monitor authentication failures and potential security threats.

Building a Monitoring Dashboard with Snowflake Views

To operationalize monitoring, you can create a dashboard using Snowsight (Snowflake's web interface) or export data to a BI tool. Here's a sample query that combines multiple views into a single health check report.

health_check.sqlSQL
1
2
3
4
5
6
-- Account health summary for the last hour
SELECT
  (SELECT COUNT(*) FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY WHERE start_time >= DATEADD('hour', -1, CURRENT_TIMESTAMP())) AS queries_last_hour,
  (SELECT SUM(credits_used) FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY WHERE start_time >= DATEADD('hour', -1, CURRENT_TIMESTAMP())) AS credits_last_hour,
  (SELECT COUNT(*) FROM SNOWFLAKE.ACCOUNT_USAGE.LOGIN_HISTORY WHERE is_success = 'NO' AND event_timestamp >= DATEADD('hour', -1, CURRENT_TIMESTAMP())) AS failed_logins_last_hour,
  (SELECT COUNT(*) FROM SNOWFLAKE.ACCOUNT_USAGE.SESSIONS) AS active_sessions;
Output
+-------------------+-----------------+------------------------+----------------+
| QUERIES_LAST_HOUR | CREDITS_LAST_HOUR | FAILED_LOGINS_LAST_HOUR | ACTIVE_SESSIONS |
+-------------------+-----------------+------------------------+----------------+
| 150 | 3.5 | 0 | 12 |
+-------------------+-----------------+------------------------+----------------+
💡Automating Alerts
📊 Production Insight
Schedule a task to run this query every 5 minutes and insert results into a monitoring table for historical analysis.
🎯 Key Takeaway
Combine multiple views into a single health check query for a quick overview.

Using INFORMATION_SCHEMA for Near Real-Time Monitoring

When you need up-to-the-minute data, INFORMATION_SCHEMA views like QUERY_HISTORY_BY_SESSION are your friend. They reflect data within minutes. For example, to see queries currently running or recently completed for your session.

recent_queries.sqlSQL
1
2
3
4
5
6
7
8
9
-- Last 10 queries for the current session
SELECT
  query_id,
  query_text,
  execution_time,
  start_time,
  end_time
FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY_BY_SESSION(RESULT_LIMIT => 10))
ORDER BY start_time DESC;
Output
+--------------------------------------+----------------------------+----------------+---------------------------+---------------------------+
| QUERY_ID | QUERY_TEXT | EXECUTION_TIME | START_TIME | END_TIME |
+--------------------------------------+----------------------------+----------------+---------------------------+---------------------------+
| 0192a3b4-0501-1234-0000-000000000002 | SELECT * FROM my_table | 200 | 2025-03-15 16:00:00.000 | 2025-03-15 16:00:00.200 |
| ... | ... | ... | ... | ... |
+--------------------------------------+----------------------------+----------------+---------------------------+---------------------------+
🔥Session vs Account
📊 Production Insight
Use QUERY_HISTORY_BY_SESSION in scripts to monitor long-running queries and kill them if necessary (SYSTEM$CANCEL_QUERY).
🎯 Key Takeaway
INFORMATION_SCHEMA provides near real-time query history for debugging active issues.
● Production incidentPOST-MORTEMseverity: high

The Phantom Warehouse: When Auto-Suspend Didn't Suspend

Symptom
Users reported no issues, but the finance team noticed a sudden 2x increase in Snowflake costs over the weekend.
Assumption
The developer assumed the warehouse was set to auto-suspend after 5 minutes of inactivity, as per standard configuration.
Root cause
A recent deployment had changed the warehouse's auto-suspend setting to 'Never' (0 minutes) to support a long-running batch job, but the change was never reverted. The warehouse ran continuously for 48 hours, consuming credits even when idle.
Fix
Set the warehouse auto-suspend back to 5 minutes using: ALTER WAREHOUSE my_wh SET AUTO_SUSPEND = 300; Also added a monitor on warehouse credits using ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY.
Key lesson
  • Always double-check warehouse settings after any deployment that modifies them.
  • Set up automated alerts on credit consumption anomalies (e.g., >20% daily increase).
  • Use ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY to track warehouse credit usage over time.
  • Implement a policy that warehouses must have auto-suspend enabled (except for rare exceptions with approval).
  • Regularly audit warehouse configurations using SHOW WAREHOUSES and compare with expected settings.
Production debug guideSymptom to Action4 entries
Symptom · 01
Query is running longer than expected
Fix
Check QUERY_HISTORY for the query's execution time, bytes scanned, and partitions pruned. Look for full scans or missing filters.
Symptom · 02
Credit consumption spiked unexpectedly
Fix
Query WAREHOUSE_METERING_HISTORY to see which warehouse(s) consumed credits. Then check QUERY_HISTORY for queries that ran during that period.
Symptom · 03
Users reporting 'warehouse not found' errors
Fix
Check LOGIN_HISTORY for failed login attempts and SESSIONS for active sessions. Verify warehouse existence with SHOW WAREHOUSES.
Symptom · 04
Storage costs increasing without new data
Fix
Use STORAGE_USAGE to see which database/schema is growing. Check TABLE_STORAGE_METRICS for large tables or clones.
★ Quick Debug Cheat SheetCommon symptoms and immediate actions for Snowflake monitoring issues.
Slow query
Immediate action
Check QUERY_HISTORY for the query ID, look at execution time and bytes scanned.
Commands
SELECT query_id, query_text, execution_time, bytes_scanned FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY WHERE query_id = '<query_id>';
SELECT * FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY_BY_SESSION(RESULT_LIMIT => 10)) ORDER BY START_TIME DESC;
Fix now
Add filters or indexes; consider clustering.
High credit usage+
Immediate action
Check WAREHOUSE_METERING_HISTORY for the past 24 hours.
Commands
SELECT warehouse_name, SUM(credits_used) AS total_credits FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY WHERE start_time >= DATEADD('day', -1, CURRENT_TIMESTAMP()) GROUP BY warehouse_name ORDER BY total_credits DESC;
SELECT query_id, warehouse_name, credits_used FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY WHERE start_time >= DATEADD('day', -1, CURRENT_TIMESTAMP()) ORDER BY credits_used DESC;
Fix now
Suspend idle warehouses; set auto-suspend.
Warehouse not found+
Immediate action
Check if warehouse exists and is running.
Commands
SHOW WAREHOUSES;
SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_EVENTS_HISTORY WHERE event = 'DROP' OR event = 'SUSPEND';
Fix now
Recreate or resume the warehouse.
FeatureACCOUNT_USAGEINFORMATION_SCHEMA
Data latencyUp to 2 hoursMinutes
History retentionUp to 365 days7 days (typical)
Use caseTrend analysis, cost reportingReal-time debugging, alerts
Example viewsQUERY_HISTORY, WAREHOUSE_METERING_HISTORYQUERY_HISTORY_BY_SESSION, QUERY_HISTORY
⚙ Quick Reference
7 commands from this guide
FileCommand / CodePurpose
explore_views.sqlSELECT view_name FROM SNOWFLAKE.ACCOUNT_USAGE.VIEWS;Introduction to Snowflake Monitoring Views
slow_queries.sqlSELECTQuerying Query History for Performance Analysis
warehouse_credits.sqlSELECTMonitoring Warehouse Credit Consumption
storage_usage.sqlSELECTTracking Storage Usage and Growth
login_history.sqlSELECTAnalyzing Login and Session History
health_check.sqlSELECTBuilding a Monitoring Dashboard with Snowflake Views
recent_queries.sqlSELECTUsing INFORMATION_SCHEMA for Near Real-Time Monitoring

Key takeaways

1
Snowflake's ACCOUNT_USAGE and INFORMATION_SCHEMA provide comprehensive monitoring data for queries, warehouses, storage, and logins.
2
Use QUERY_HISTORY to identify slow queries and optimize performance; use WAREHOUSE_METERING_HISTORY to track credit consumption.
3
Set up alerts using Snowflake ALERT objects or scheduled tasks to proactively detect anomalies.
4
Always consider data latency
ACCOUNT_USAGE for trends, INFORMATION_SCHEMA for real-time debugging.
5
Regularly audit warehouse configurations and storage usage to avoid unexpected costs.

Common mistakes to avoid

5 patterns
×

Relying solely on ACCOUNT_USAGE for real-time alerts

×

Not filtering by time range in QUERY_HISTORY

×

Assuming credits_used in QUERY_HISTORY reflects warehouse cost

×

Ignoring storage costs from time travel and fail-safe

×

Not using role-based access for monitoring views

INTERVIEW PREP · PRACTICE MODE

Interview Questions on This Topic

Q01SENIOR
How would you identify the top 5 most expensive queries in terms of cred...
Q02JUNIOR
Explain the difference between ACCOUNT_USAGE and INFORMATION_SCHEMA for ...
Q03SENIOR
How can you detect a warehouse that is not auto-suspending properly?
Q04JUNIOR
Write a query to find the average execution time per warehouse for the l...
Q05SENIOR
How would you set up an alert for when a query takes longer than 10 minu...
Q01 of 05SENIOR

How would you identify the top 5 most expensive queries in terms of credits in the last week?

ANSWER
Query SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY, filter by start_time >= DATEADD('week', -1, CURRENT_TIMESTAMP()), group by query_id, and sum credits_used. Order by total credits descending and limit 5.
FAQ · 5 QUESTIONS

Frequently Asked Questions

01
What is the difference between SNOWFLAKE.ACCOUNT_USAGE and INFORMATION_SCHEMA?
02
How can I monitor credit usage per user?
03
Can I set up alerts in Snowflake without third-party tools?
04
How do I find queries that are currently running?
05
What is the best way to reduce storage costs?
N
Naren Founder & Principal Engineer

20+ years shipping high-throughput database systems. Drawn from code that ran under real load.

Follow
Verified
production tested
July 17, 2026
last updated
2,439
articles · all by Naren
🔥

That's Snowflake. Mark it forged?

3 min read · try the examples if you haven't

Previous
Snowpark for Python: DataFrame API, Stored Procedures, and App Development
19 / 33 · Snowflake
Next
Cortex AI: Machine Learning, LLMs, and AI Workloads