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 Name

Data Type

Description

ORGANIZATION_NAME

VARCHAR

Name of the organization.

ACCOUNT_LOCATOR

VARCHAR

System-generated identifier for the account.

ACCOUNT_NAME

VARCHAR

User-defined identifier for the account.

Additional columns

Column name

Data type

Description

QUERY_ID

VARCHAR

Internal/system-generated identifier for the SQL statement.

PARENT_QUERY_ID

VARCHAR

Query ID of the parent query or NULL if the query does not have a parent.

ROOT_QUERY_ID

VARCHAR

Query ID of the topmost query in the chain or NULL if the query does not have a parent.

WAREHOUSE_ID

NUMBER

Internal/system-generated identifier for the warehouse that the query was executed on.

WAREHOUSE_NAME

VARCHAR

Name of the warehouse that the query executed on.

QUERY_HASH

VARCHAR

The hash value computed based on the canonicalized SQL text.

QUERY_PARAMETERIZED_HASH

VARCHAR

The hash value computed based on the parameterized query.

QUERY_TAG

VARCHAR

Query tag set for this statement through the QUERY_TAG session parameter.

USER_NAME

VARCHAR

User who issued the query.

START_TIME

TIMESTAMP_LTZ

Time when query execution started (in the local time zone).

END_TIME

TIMESTAMP_LTZ

Time when query execution ended (in the local time zone).

CREDITS_ATTRIBUTED_COMPUTE

NUMBER

Number 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_ACCELERATION

NUMBER

Number 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.

  • 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.