Exploring Overall Cost¶
You can explore historical cost using Snowsight, the Snowflake web interface, or by writing queries against views in the ACCOUNT_USAGE and ORGANIZATION_USAGE schemas. Snowsight allows you to quickly and easily obtain information about cost from a visual dashboard. Queries against the usage views allow you to drill down into cost data and can help generate custom reports and dashboards.
If you need an introduction to how costs are incurred in Snowflake, refer to Understanding Overall Cost.
Accessing Cost and Usage Data¶
By default, only the account administrator (i.e. user with the ACCOUNTADMIN role) can view cost and usage data in Snowsight, the ACCOUNT_USAGE schema, and the ORGANIZATION_USAGE schema.
An administrator with the USERADMIN role or higher can use SNOWFLAKE database roles to grant access to other users. The following SNOWFLAKE database roles provide access to cost and usage data:
USAGE_VIEWER — Provides access to a single account in Snowsight and to related views in the ACCOUNT_USAGE schema.
ORGANIZATION_USAGE_VIEWER — Assuming the current account is the ORGADMIN account, provides access to all accounts in Snowsight and to views in the ORGANIZATION_USAGE schema that are related to cost and usage, but not billing.
To learn how to use SNOWFLAKE database roles to provide access to a user, refer to Using SNOWFLAKE Database Roles.
Viewing Overall Cost¶
An account administrator (i.e. a user with the ACCOUNTADMIN role) can use Snowsight to view the overall cost of using Snowflake for any given day, week, or month.
To use Snowsight to explore overall cost:
Navigate to Admin » Usage.
Select a warehouse to use to view the usage data. Snowflake recommends using an XS warehouse for this purpose.
Select All Usage Types from the drop-down list.
This totals the cost of compute, storage, and data transfer resources and displays them in a bar graph using the organization’s currency. The total cost of these resources during the selected time period appears above the bar graph.
Querying Data for Overall Cost¶
Snowflake provides two schemas, ORGANIZATION_USAGE and ACCOUNT_USAGE, that contain data related to usage and cost. The ORGANIZATION_USAGE schema provides cost information for all of the accounts in the organization while the ACCOUNT_USAGE schema provides similar information for a single account. Views in these schemas provide granular, analytics-ready usage data to build custom reports or dashboards.
The following query combines data from the USAGE_IN_CURRENCY view in the ORGANIZATION_USAGE schema in order to gain insight into the overall cost of using Snowflake.
Query: Total usage costs in dollars for the organization, broken down by account
select account_name, round(sum(usage_in_currency), 2) as usage_in_currency from snowflake.organization_usage.usage_in_currency_daily where usage_date > DATEADD(Month,-1,CURRENT_TIMESTAMP()) group by 1 order by 2 desc;