Schema:

ORGANIZATION_USAGE

For guidance on query performance when using organization-wide usage views, see Performance (Organization Usage).

AGGREGATE_QUERY_HISTORY view

Important

This view is only available in the organization account. For more information, see Premium views in the organization account.

Organization Usage performance

When you query a specific view in the SNOWFLAKE.ORGANIZATION_USAGE schema, follow the organization-wide guidance in Performance (Organization Usage): bound every scan on history views, list columns explicitly, and use the time filter column table plus worked SQL and anti-patterns there.

This Organization Usage view enables you to monitor and track the execution of statements over time across the accounts in your organization. It contains similar data to the QUERY_HISTORY view but is aggregated in one-minute intervals for repeated SQL statements.

This view contains the same data as the AGGREGATE_QUERY_HISTORY view in the ACCOUNT_USAGE schema, additionally aggregated at the organization level. For details about how the data is aggregated, the fields returned by the OBJECT columns, and example queries, see the AGGREGATE_QUERY_HISTORY view in the ACCOUNT_USAGE schema.

This view is available only in the organization account. Users with the GLOBALORGADMIN role, or users granted the SNOWFLAKE.ORGANIZATION_GOVERNANCE_VIEWER application role, can access it. For details, see Accessing the ORGANIZATION_USAGE schema.

Columns

Organization-level columns

Column NameData TypeDescription
ORGANIZATION_NAMEVARCHARName of the organization.
ACCOUNT_LOCATORVARCHARSystem-generated identifier for the account.
ACCOUNT_NAMEVARCHARUser-defined identifier for the account.

Additional columns

Column NameData TypeDescription
CALLSNUMBERNumber of times the statement (query + query plan) was executed in the aggregation interval.
INTERVAL_START_TIMETIMESTAMP_LTZStart time of the window of measurement (in the local time zone).
INTERVAL_END_TIMETIMESTAMP_LTZEnd time of the window of measurement (in the local time zone).
QUERY_PARAMETERIZED_HASHTEXTUnique ID to identify identical parameterized queries. See QUERY_PARAMETERIZED_HASH column.
QUERY_TEXTTEXTSample text of the SQL statement.
DATABASE_IDNUMBERInternal/system-generated identifier for the database that was in use.
DATABASE_NAMETEXTDatabase that was in use at the time of the query.
SCHEMA_IDNUMBERInternal/system-generated identifier for the schema that was in use.
SCHEMA_NAMETEXTSchema that was in use at the time of the query.
QUERY_TYPETEXTDML, query, etc. If the query failed, then the query type may be UNKNOWN.
SESSION_IDNUMBERSession that executed the statement.
USER_NAMETEXTUser who issued the query.
ROLE_NAMETEXTRole that was active in the session at the time of the query.
ROLE_TYPETEXTSpecifies APPLICATION, DATABASE_ROLE, or ROLE that executed the query.
WAREHOUSE_IDNUMBERInternal/system-generated identifier for the warehouse that was used.
WAREHOUSE_NAMETEXTWarehouse that the query executed on, if any.
WAREHOUSE_SIZETEXTSize of the warehouse when this statement executed.
WAREHOUSE_TYPETEXTType of the warehouse when this statement executed.
QUERY_TAGTEXTQuery tag set for this statement through the QUERY_TAG session parameter.
IS_CLIENT_GENERATED_STATEMENTBOOLEANIndicates whether the query was client-generated.
RELEASE_VERSIONTEXTRelease version in the format of major_release.minor_release.patch_release.
ERRORSARRAYList of error codes and messages that occurred during the aggregation interval. Each error is in the format of {"code": "code1", "message": "msg1", "count": 10}.
TOTAL_ELAPSED_TIMEOBJECTElapsed time (in milliseconds).
BYTES_SCANNEDOBJECTNumber of bytes scanned by this statement.
PERCENTAGE_SCANNED_FROM_CACHEOBJECTThe percentage of data scanned from the local disk cache. The value ranges from 0.0 to 1.0. Multiply by 100 to get a true percentage.
BYTES_WRITTENOBJECTNumber of bytes written (for example, when loading into a table).
BYTES_WRITTEN_TO_RESULTOBJECTNumber of bytes written to a result object. For example, select * from . . . would produce a set of results in tabular format representing each field in the selection.

In general, the results object represents whatever is produced as a result of the query, and BYTES_WRITTEN_TO_RESULT represents the size of the returned result.
BYTES_READ_FROM_RESULTOBJECTNumber of bytes read from a result object.
ROWS_PRODUCEDOBJECTNumber of rows produced by this statement.
ROWS_INSERTEDOBJECTNumber of rows inserted by the query.
ROWS_UPDATEDOBJECTNumber of rows updated by the query.
ROWS_DELETEDOBJECTNumber of rows deleted by the query.
ROWS_UNLOADEDOBJECTNumber of rows unloaded during data export.
BYTES_DELETEDOBJECTNumber of bytes deleted by the query.
PARTITIONS_SCANNEDOBJECTNumber of micro-partitions scanned.
PARTITIONS_TOTALOBJECTTotal micro-partitions of all tables included in this query.
BYTES_SPILLED_TO_LOCAL_STORAGEOBJECTVolume of data spilled to local disk.
BYTES_SPILLED_TO_REMOTE_STORAGEOBJECTVolume of data spilled to remote disk.
BYTES_SENT_OVER_THE_NETWORKOBJECTVolume of data sent over the network.
COMPILATION_TIMEOBJECTCompilation time (in milliseconds).
EXECUTION_TIMEOBJECTExecution time (in milliseconds).
QUEUED_PROVISIONING_TIMEOBJECTTime (in milliseconds) spent in the warehouse queue, waiting for the warehouse compute resources to provision, due to warehouse creation, resume, or resize.
QUEUED_REPAIR_TIMEOBJECTTime (in milliseconds) spent in the warehouse queue, waiting for compute resources in the warehouse to be repaired.
QUEUED_OVERLOAD_TIMEOBJECTTime (in milliseconds) spent in the warehouse queue, due to the warehouse being overloaded by the current query workload.
TRANSACTION_BLOCKED_TIMEOBJECTTime (in milliseconds) spent blocked by a concurrent DML.
OUTBOUND_DATA_TRANSFER_CLOUDTEXTTarget cloud provider for statements that unload data to another region and/or cloud.
OUTBOUND_DATA_TRANSFER_REGIONTEXTTarget region for statements that unload data to another region and/or cloud.
OUTBOUND_DATA_TRANSFER_BYTESOBJECTNumber of bytes transferred in statements that unload data to another region and/or cloud.
INBOUND_DATA_TRANSFER_CLOUDTEXTSource cloud provider for statements that load data from another region and/or cloud.
INBOUND_DATA_TRANSFER_REGIONTEXTSource region for statements that load data from another region and/or cloud.
INBOUND_DATA_TRANSFER_BYTESOBJECTNumber of bytes transferred in a replication operation from another account. The source account could be in the same region or a different region than the current account.
LIST_EXTERNAL_FILES_TIMEOBJECTTime (in milliseconds) spent listing external files.
CREDITS_USED_CLOUD_SERVICESOBJECTNumber of credits used for cloud services.
EXTERNAL_FUNCTION_TOTAL_INVOCATIONSOBJECTAggregate number of times that this query called remote services.
EXTERNAL_FUNCTION_TOTAL_SENT_ROWSOBJECTTotal number of rows that this query sent in all calls to all remote services.
EXTERNAL_FUNCTION_TOTAL_RECEIVED_ROWSOBJECTTotal number of rows that this query received from all calls to all remote services.
EXTERNAL_FUNCTION_TOTAL_SENT_BYTESOBJECTTotal number of bytes that this query sent in all calls to all remote services.
EXTERNAL_FUNCTION_TOTAL_RECEIVED_BYTESOBJECTTotal number of bytes that this query received from all calls to all remote services.
QUERY_LOAD_PERCENTOBJECTThe approximate percentage of active compute resources in the warehouse for this query execution.
QUERY_ACCELERATION_BYTES_SCANNEDOBJECTNumber of bytes scanned by the query acceleration service.
QUERY_ACCELERATION_PARTITIONS_SCANNEDOBJECTNumber of partitions scanned by the query acceleration service.
QUERY_ACCELERATION_UPPER_LIMIT_SCALE_FACTOROBJECTUpper limit scale factor that a query would have benefited from.
CHILD_QUERIES_WAIT_TIMEOBJECTTime (in milliseconds) to complete the cached lookup when calling a memoizable function.
HYBRID_TABLE_REQUESTS_THROTTLED_COUNTNUMBERNumber of hybrid table queries that were throttled.

For columns with the OBJECT data type, the object contains statistical fields (such as sum, avg, and percentiles) computed across all executions within the aggregation interval. For a description of these fields, see the AGGREGATE_QUERY_HISTORY view in the ACCOUNT_USAGE schema.

Usage notes

  • Latency for the view may be up to 24 hours.
  • The data is retained for 365 days (1 year).

Examples

For example queries, see the AGGREGATE_QUERY_HISTORY view in the ACCOUNT_USAGE schema. To find organization-level information, replace SNOWFLAKE.ACCOUNT_USAGE with SNOWFLAKE.ORGANIZATION_USAGE in the queries.