- Schema:
METERING_DAILY_HISTORY view¶
The METERING_DAILY_HISTORY view in the ORGANIZATION_USAGE schema can be used to return the daily credit usage and a cloud services rebate for an organization within the last 365 days (1 year).
Columns¶
Column Name |
Data Type |
Description |
---|---|---|
SERVICE_TYPE |
VARCHAR |
Type of service that is consuming credits, which can be one of the following:
|
ORGANIZATION_NAME |
VARCHAR |
Name of the organization where the usage took place. |
ACCOUNT_NAME |
VARCHAR |
Name of the account where the usage took place. |
ACCOUNT_LOCATOR |
VARCHAR |
Locator for the account where the usage took place. |
USAGE_DATE |
DATE |
The date (in the UTC time zone) in which the usage took place. |
CREDITS_USED_COMPUTE |
NUMBER |
Number of credits used for warehouses and serverless compute resources during the USAGE_DATE. |
CREDITS_USED_CLOUD_SERVICES |
NUMBER |
Number of credits used for cloud services during the USAGE_DATE. |
CREDITS_USED |
NUMBER |
Total of CREDITS_USED_COMPUTE plus CREDITS_USED_CLOUD_SERVICES. |
CREDITS_ADJUSTMENT_CLOUD_SERVICES |
NUMBER |
Number of credits adjusted for cloud services. This is a negative value (e.g. -9). |
CREDITS_BILLED |
NUMBER |
Total number of credits billed for the account in the day. This is a sum of CREDITS_USED_COMPUTE, CREDITS_USED_CLOUD_SERVICES, and CREDITS_ADJUSTMENT_CLOUD_SERVICES. |
REGION |
VARCHAR |
ID of the Snowflake Region where the account is located. |
Usage notes¶
Latency for the view may be up to 120 minutes (2 hours).
The data is retained for 365 days (1 year).
Example¶
Usage for cloud services is billed only if the daily consumption of cloud services exceeds 10% of the daily usage of virtual warehouses. This query returns how much of cloud services consumption was actually billed for a particular day, ordered by the highest billed amount.
SELECT
usage_date,
credits_used_cloud_services,
credits_adjustment_cloud_services,
credits_used_cloud_services + credits_adjustment_cloud_services AS billed_cloud_services
FROM snowflake.organization_usage.metering_daily_history
WHERE usage_date >= DATEADD(month,-1,CURRENT_TIMESTAMP())
AND credits_used_cloud_services > 0
ORDER BY 4 DESC;