Schemas:

ACCOUNT_USAGE , READER_ACCOUNT_USAGE

METERING_HISTORY view

The METERING_HISTORY view in the ACCOUNT_USAGE schema can be used to return the hourly credit usage for an account within the last 365 days (1 year).

Columns

Column Name

Data Type

Description

SERVICE_TYPE

VARCHAR

Type of service that is consuming credits. The following list includes many, but not all, of the possible service types:

START_TIME

TIMESTAMP_LTZ

The date and beginning of the hour (in the local time zone) in which the usage took place.

END_TIME

TIMESTAMP_LTZ

The date and end of the hour (in the local time zone) in which the usage took place.

ENTITY_ID

NUMBER

A system-generated identifier for the entity associated with the service.

In most cases, this is the internal ID of the monitored entity; for example, a pipe, task, or replication group.

When the SERVICE_TYPE is COPY_FILES, this column shows the ID of the database, schema, or stage from which files are copied.

If the SERVICE_TYPE is an Openflow type, the value is NULL.

If the SERVICE_TYPE is Snowpipe Streaming, this shows the ID of the relevant pipe; which is the default pipe ID for the default pipe.

ENTITY_TYPE

VARCHAR

Type of Snowflake resource that consumed credits, such as WAREHOUSE, TASK, or TABLE. Note that TABLE is used for all table-like objects.

NAME

VARCHAR

The name of the service or object associated with the cost entry, which varies significantly based on the SERVICE_TYPE.

Standard (General): This column shows the name of the service type itself; for example, REPLICATION, TASK.

SNOWPIPE_STREAMING: This service type generates two distinct cost entries, and the NAME column varies for each:

  • Cost entry 1 (table name): The value is the name of the Snowflake target table. For the high-performance default pipe, the name is derived from the target table name and appended with -STREAMING; for example, MY_TABLE-STREAMING.

  • Cost entry 2 (client string): The value is a colon-separated string in the format: SNOWPIPE_STREAMING:CLIENT_NAME:SNOWFLAKE_PROVIDED_ID. This is used for tracking client-side costs.

COPY_FILES: The value is the name of the database from which the files are copied.

Openflow Types: The value is NULL.

DATABASE_ID

NUMBER

Internal/system-generated identifier of the database associated with the resource of type ENTITY_TYPE. Contains a NULL value when the resource isn’t associated with a specific database; for example, a warehouse or compute pool.

DATABASE_NAME

VARCHAR

Name of the database associated with the resource of type ENTITY_TYPE. Contains a NULL value when the resource isn’t associated with a specific database.

SCHEMA_ID

NUMBER

Internal or system-generated identifier of the schema associated with the resource of type ENTITY_TYPE. Contains a NULL value when the resource isn’t associated with a specific schema.

SCHEMA_NAME

VARCHAR

Name of the schema associated with the resource of type ENTITY_TYPE. Contains a NULL value when the resource isn’t associated with a specific schema.

CREDITS_USED_COMPUTE

NUMBER

Number of credits used by warehouses, serverless compute, and Openflow resources in the hour.

CREDITS_USED_CLOUD_SERVICES

NUMBER

Number of credits used for cloud services in the hour. Always 0 when the SERVICE_TYPE is one of the Openflow types.

CREDITS_USED

NUMBER

Total number of credits used for the account in the hour. This is a sum of CREDITS_USED_COMPUTE and CREDITS_USED_CLOUD_SERVICES. This value does not take into account the adjustment for cloud services, and may therefore be greater than your actual credit consumption.

BYTES

NUMBER

When the service type is auto_clustering, indicates the number of bytes reclustered during the START_TIME and END_TIME window. When the service type is pipe, indicates the number of bytes inserted during the START_TIME and END_TIME window. When the service type is SNOWPIPE_STREAMING, indicates the number of bytes migrated during the START_TIME and END_TIME window. When the service type is COPY_FILES, columns are aggregated at the database level.

ROWS

NUMBER

When the service type is auto_clustering, indicates number of rows reclustered during the START_TIME and END_TIME window. When the service type is SNOWPIPE_STREAMING, indicates the number of rows migrated during the START_TIME and END_TIME window.

FILES

NUMBER

When the service type is pipe, indicates number of files loaded during the START_TIME and END_TIME window. When the service type is SNOWPIPE_STREAMING, this is NULL. When the service type is COPY_FILES, columns are aggregated at the database level.

Usage notes

  • Latency for the view may be up to 180 minutes (3 hours), except for the CREDITS_USED_CLOUD_SERVICES column. Latency for CREDITS_USED_CLOUD_SERVICES may be up to 6 hours.

  • Latency for showing the credit consumption of SNOWPIPE_STREAMING may be up to 12 hours.