Schema:

ORGANIZATION_USAGE

QUERY_ATTRIBUTION_HISTORY view

Important

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

This Organization Usage view can be used to determine the compute cost of a given query run on warehouses in your organization.

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
QUERY_IDVARCHARInternal/system-generated identifier for the SQL statement.
PARENT_QUERY_IDVARCHARQuery ID of the parent query or NULL if the query does not have a parent.
ROOT_QUERY_IDVARCHARQuery ID of the topmost query in the chain or NULL if the query does not have a parent.
WAREHOUSE_IDNUMBERInternal/system-generated identifier for the warehouse that the query was executed on.
WAREHOUSE_NAMEVARCHARName of the warehouse that the query executed on.
QUERY_HASHVARCHARThe hash value computed based on the canonicalized SQL text.
QUERY_PARAMETERIZED_HASHVARCHARThe hash value computed based on the parameterized query.
QUERY_TAGVARCHARQuery tag set for this statement through the QUERY_TAG session parameter.
USER_NAMEVARCHARUser who issued the query.
START_TIMETIMESTAMP_LTZTime when query execution started (in the local time zone).
END_TIMETIMESTAMP_LTZTime when query execution ended (in the local time zone).
CREDITS_ATTRIBUTED_COMPUTEFLOATNumber of credits attributed to this query. Includes only the credit usage for the query execution and doesn’t include any warehouse idle time.
CREDITS_USED_QUERY_ACCELERATIONFLOATNumber of credits consumed by the Query Acceleration Service to accelerate the query. NULL if the query is not accelerated.

The total cost for an accelerated query is the sum of this column and the CREDITS_ATTRIBUTED_COMPUTE column.

Usage notes

  • Latency for the view may be up to 24 hours.
  • This view doesn’t include records for jobs executed by adaptive warehouses.
  • The QUERY_ATTRIBUTE_HISTORY view in the ACCOUNT_USAGE schema contains most of the same columns as the QUERY_ATTRIBUTE_HISTORY view in the ORGANIZATION_USAGE schema. For sample queries against the ACCOUNT_USAGE view, see Examples. Simply replace SNOWFLAKE.ACCOUNT_USAGE with SNOWFLAKE.ORGANIZATION_USAGE in the queries to find organization-level information.