Module 20 · Lesson 2 of 11Detailed study · about 34 min

Snowflake Monitoring Views: Account Usage, Information Schema and Organization Usage

Choose the right source of Snowflake activity history for an incident, a trend report or a cross-account cost review. Compare visibility, delay and retention.

Before you beginLearn what monitoring signals mean

Choose the history that can answer your question

Snowflake writes records about activity such as loads, logins and queries. Some records are visible through functions for recent work. Reporting views often hold much longer history, with a delay before new rows show up. A successful query from one source does not guarantee the same events have appeared in another.

INFORMATION_SCHEMA belongs to each database and provides views and table functions. The scope of a function depends on the function and your permissions. For example, query history can show authorized account activity even when you qualify the function with a scratch database. ACCOUNT_USAGE is a reporting schema in the shared SNOWFLAKE database. ORGANIZATION_USAGE offers organization-level reporting where the account, edition and role support the view.

Scope and freshness at a glance
SourceTypical useTime coverage and visibility
<db>.INFORMATION_SCHEMACurrent incident and recent activityQuery and task functions cover up to 7 days, COPY_HISTORY up to 14. Read permissions and limits per function.
SNOWFLAKE.ACCOUNT_USAGESingle-account reporting and audit trendsThe histories listed below generally retain 365 days. Most appear after a delay.
SNOWFLAKE.ORGANIZATION_USAGECompare accounts or consolidate billingAvailability differs between organization accounts and ORGADMIN-enabled regular accounts. METERING_DAILY_HISTORY retains 365 days and can be up to 24 hours behind.
Choose a history for the decision you need to make A role may be able to read one source without having access to the others.
  1. Operational questionLive triage to Information Schema
  2. Operational questionHistorical trend to Account Usage
  3. Operational questionCross-account trend to Organization Usage
Operational question
What happened just now, over the last month, or across accounts?
Information Schema
Use the current account’s recent history for triage.
Account Usage
Use longer single-account history after publication delay.
Organization Usage
Use supported views for authorized cross-account reporting.

What the key Account Usage views tell you

These are documentation latency bounds for the views shown. Some rows and columns have extra delays. Keep the data type and unit next to each metric. A query ID connects activity records, but require a separate batch ID to connect source and target totals.

Account Usage monitoring views
ViewExample evidence to readReported latency
QUERY_HISTORYQUERY_ID, EXECUTION_STATUS, TOTAL_ELAPSED_TIMEUp to 45 min
WAREHOUSE_LOAD_HISTORYAVG_RUNNING, AVG_QUEUED_LOAD, AVG_BLOCKEDUp to 3 h
WAREHOUSE_METERING_HISTORYCREDITS_USED_COMPUTE, CREDITS_USED_CLOUD_SERVICESUp to 3 h, cloud-services column up to 6 h
COPY_HISTORYFILE_NAME, STATUS, ROW_COUNT, FIRST_ERROR_MESSAGEUp to 2 h normally; up to 2 days if both activity thresholds in the view notes are unmet
LOAD_HISTORYFILE_NAME, TABLE_NAME, ERROR_COUNT for bulk COPYUp to 90 min normally; same low-activity exception as COPY_HISTORY
TASK_HISTORYNAME, SCHEDULED_TIME, STATE, QUERY_IDUp to 45 min
LOGIN_HISTORYEVENT_TIMESTAMP, USER_NAME, IS_SUCCESS, ERROR_CODEUp to 2 h
ACCESS_HISTORYQUERY_ID, DIRECT_OBJECTS_ACCESSED, BASE_OBJECTS_ACCESSEDUp to 3 h, Enterprise Edition or higher

Grant access to the needed histories

Ask the account administrator to grant a Snowflake database role to an existing custom account role. The example assumes the administrator has the required grant authority and the team already has OPS_MONITOR and an approved warehouse. USAGE_VIEWER covers the warehouse, COPY_HISTORY, LOAD_HISTORY and TASK_HISTORY views. GOVERNANCE_VIEWER covers query and access history, and SECURITY_VIEWER covers login history. The Information Schema functions have their own object privileges. For example, task history may be visible to an owner or a role with MONITOR on the task. Bulk COPY history needs the applicable account-level monitoring privilege or parent USAGE plus a privilege on the target table. Split security reporting from general dashboard access if the audience does not need identities, SQL text or object names.

SQL · configuration template
GRANT DATABASE ROLE SNOWFLAKE.USAGE_VIEWER TO ROLE OPS_MONITOR;
GRANT DATABASE ROLE SNOWFLAKE.GOVERNANCE_VIEWER TO ROLE OPS_MONITOR;

Read recent activity and then check historical context

Use a scratch or approved database in the qualified function. END_TIME_RANGE_START limits the end-time window. With no END_TIME_RANGE_END, the query function can also include currently running queries. RESULT_LIMIT applies before the outer WHERE clause. A busy account may require a narrower time window or a more specific history function.

Run these read-only statements with an approved warehouse and the documented monitoring role. If unauthorized rows are missing, compare the same time range with the object owner. For a quiet test account, empty results are normal. The values below illustrate what the columns would look like on a populated account.

Representative rows from three different histories
HistoryKeyWhat can be inferred
Queryq-maple-172,500 elapsed ms for a SUCCESS result
Warehouse loadMAPLE_WH at 07:50 UTC2.10 average running load and 0.40 average overload queue during that interval
Warehouse meteringMAPLE_WH at 07:00 UTC0.30 warehouse compute credits for the hourly record, before applying any billing adjustment to cloud services
SQL · configuration template
SELECT query_id, execution_status, total_elapsed_time
FROM TABLE(LS_M20_OPS_LAB.INFORMATION_SCHEMA.QUERY_HISTORY(
  END_TIME_RANGE_START => DATEADD('minute', -30, CURRENT_TIMESTAMP()),
  RESULT_LIMIT => 1000
))
ORDER BY start_time DESC;

SELECT start_time, warehouse_name, avg_running, avg_queued_load, avg_blocked
FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_LOAD_HISTORY
WHERE start_time >= DATEADD('day', -1, CURRENT_TIMESTAMP())
ORDER BY start_time DESC LIMIT 20;

SELECT start_time, warehouse_name, credits_used_compute, credits_used_cloud_services
FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
WHERE start_time >= DATEADD('day', -1, CURRENT_TIMESTAMP())
ORDER BY start_time DESC LIMIT 20;

Read load, task and audited access records

Use the appropriate role for each statement. In the first query, use the table name and database that actually own the load. Use COPY_HISTORY for bulk COPY and file-based Snowpipe. LOAD_HISTORY only covers bulk COPY. Neither is the general location for streamed rows. Task history shows the state of an execution, while login and access histories answer different identity questions. A successful login is not evidence that a user read a given table.

Pipes, Streaming and Dynamic Tables have specialized interfaces. See the pipeline lesson for the queries and sample outputs. If you need cross-account costs, run the final query with an appropriate organization role on an account with access to this view. CREDITS_USED represents metered credits with distinct billing treatment. See Module 16 for reconciliation.

Representative rows, shown with sensitive fields removed
SourceExampleMeaning
Bulk loadsales_b101.csv · 2 rows · 0 errorsThe bulk COPY loaded two rows.
TaskSALES_TASK · FAILED · q-maple-22Look up the failed query ID while the error is current.
LoginMAPLE_ANALYST · NO · error code presentAuthentication outcome, without evidence of table reads.
Accessq-maple-23 · SALES_REPORT_VIEW · SALES_TARGETA read can name a view directly and record the underlying table.
Organization meteringMAPLE_EAST · 8.25 creditsSum of metered credits across the selected completed calendar dates for that account.
SQL · configuration template
SELECT file_name, status, row_count, first_error_message
FROM TABLE(LS_M20_OPS_LAB.INFORMATION_SCHEMA.COPY_HISTORY(
  TABLE_NAME => 'LS_M20_OPS_LAB.OPS.SOURCE_ORDERS',
  START_TIME => DATEADD('day', -1, CURRENT_TIMESTAMP())
))
ORDER BY last_load_time DESC;

SELECT file_name, table_name, row_count, error_count
FROM SNOWFLAKE.ACCOUNT_USAGE.LOAD_HISTORY
WHERE last_load_time >= DATEADD('day', -1, CURRENT_TIMESTAMP())
ORDER BY last_load_time DESC LIMIT 20;

SELECT name, state, query_id, scheduled_time
FROM SNOWFLAKE.ACCOUNT_USAGE.TASK_HISTORY
ORDER BY scheduled_time DESC LIMIT 20;

SELECT event_timestamp, user_name, is_success, error_code
FROM SNOWFLAKE.ACCOUNT_USAGE.LOGIN_HISTORY
ORDER BY event_timestamp DESC LIMIT 20;

SELECT query_id, direct_objects_accessed, base_objects_accessed
FROM SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY
ORDER BY query_start_time DESC LIMIT 20;

SELECT account_name, SUM(credits_used) AS credits_used
FROM SNOWFLAKE.ORGANIZATION_USAGE.METERING_DAILY_HISTORY
WHERE usage_date >= DATEADD('day', -7, CURRENT_DATE())
  AND usage_date < CURRENT_DATE()
GROUP BY account_name ORDER BY account_name;

Interview practice

Explain the decision and the evidence you would use to test it.

Beginner · Why can two histories disagree about recency?

They can have different publication delays and permissions. I check the history’s time window, my role, and its data delay before deciding an event is missing.

SQL · How do you connect a task execution to the SQL error?

I get QUERY_ID from the task run, then look up that ID in current query history. I keep the timestamp and task name around it to find the right retry.

Production · Can you build a five-minute SLA alert using Account Usage?

I would use my own batch audit or another current data source. A 45-minute history delay alone can hide the breach. I would use Account Usage for trend reporting after it catches up.

Words used in this lesson
Metadata
Information about work or objects, such as when a query ran or which table it read.
Latency
The delay between an action and when a metadata record can be seen.
Retention
How long history is kept and can be queried.
Table function
A function that returns rows. Put it inside TABLE(...) to use it like a table in FROM.

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

Use the SQL and expected outputs in the sections above.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.

Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →

Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Before running this lesson

Maple Market is fictional. Output tables are representative. Live commands require an authorized test account and the roles, compute and edition listed in each lesson.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

Where would you look first for a query still running on your warehouse?

Try it yourself

The operations team needs only warehouse load and compute credits. Which database role should the access administrator consider?

Compare your reasoning

SNOWFLAKE.USAGE_VIEWER covers the two warehouse reporting views. Check the full privileges of that role, and use governed views if you need a narrower scope.

Connect this lesson to the learning path

Official sources and curriculum

Module 20 · See module scope

By Rohit Ray · Independent educational lesson · Explore this visual lab