Bird
Raised Fist0
SnowflakeConceptBeginner · 3 min read

What is account_usage in Snowflake: Overview and Usage

account_usage is a Snowflake shared database that provides detailed views of your account's activity and usage data. It helps you track queries, storage, users, and other account-level information for monitoring and auditing purposes.
⚙️

How It Works

Think of account_usage as a special library inside Snowflake that keeps records about everything happening in your account. It collects data on queries run, storage used, login history, and more. This data is updated regularly, usually every few hours, so you can see recent activity.

Just like a fitness tracker records your daily steps and heart rate, account_usage tracks your Snowflake account's health and activity. You can ask it questions like "Which users ran queries yesterday?" or "How much storage did we use last month?" by running simple SQL queries against its tables.

💻

Example

This example shows how to query the QUERY_HISTORY view in account_usage to find the last 5 queries run in your account.

sql
SELECT query_id, user_name, start_time, query_text
FROM snowflake.account_usage.query_history
ORDER BY start_time DESC
LIMIT 5;
Output
query_id | user_name | start_time | query_text ---------|-----------|----------------------|------------------------- 123abc | JDOE | 2024-06-01 10:15:00 | SELECT * FROM sales; 456def | AMY | 2024-06-01 10:10:00 | SHOW WAREHOUSES; 789ghi | JDOE | 2024-06-01 10:05:00 | USE DATABASE marketing; ...
🎯

When to Use

Use account_usage when you want to monitor or audit your Snowflake account's activity. For example, you can track who is running expensive queries, check storage consumption trends, or review login history for security checks.

It is especially useful for administrators and analysts who need to understand usage patterns, optimize costs, or ensure compliance with company policies.

✅

Key Points

  • Shared database: account_usage is a read-only database shared by Snowflake.
  • Data delay: Data updates every few hours, not real-time.
  • Wide coverage: Includes query history, storage, users, roles, and more.
  • SQL access: Query it using standard SQL commands.
✅

Key Takeaways

account_usage provides detailed account-level activity data in Snowflake.
It is updated periodically and accessed via SQL queries on a shared read-only database.
Use it to monitor queries, storage, users, and security events in your Snowflake account.
Ideal for administrators to track usage patterns and optimize resources.