<budget_name>!GET_SERVICE_TYPE_USAGE_V2

View the credit usage for a budget by service type.

Syntax

<budget_name>!GET_SERVICE_TYPE_USAGE_V2( '<start_month>' , '<end_month>' )

Arguments

'start_month'

Specifies the start of the time period for which you want to return usage information. Specified in the format YYYY-MM.

'end_month'

Specifies the end of the time period for which you want to return usage information. Specified in the format YYYY-MM.

Returns

The function returns the following columns:

Column NameData TypeDescription
SERVICE_TYPEVARCHARLists the service that used credits.
ENTITY_TYPEVARCHARType of object associated with the credit consumption. All table-like objects such as tables, views, materialized views, and external tables have a value of TABLE.
ENTITY_IDNUMBERInternal identifier for the object in the budget.
NAMEVARCHARName of the object associated with the credit consumption.
CREDITS_USEDFLOATNumber of credits used. This is the sum of CREDITS_COMPUTE and CREDITS_CLOUD.
CREDITS_COMPUTEFLOATNumber of compute credits used.
CREDITS_CLOUDFLOATNumber of cloud service credits used.

Access control requirements

  • The following minimum privileges and roles are required to view results for custom budgets:

  • The following role is required to view results for the account budget:

For more information, see Budgets roles and privileges.

Usage notes

Calling this method does not return the object. Because of this, you can’t use method chaining to call another method on the return value of this method. Instead, call each method in a separate SQL statement.

Example

Return credits consumed by objects associated with the budget my_budget in January, February, and March of 2025:

CALL db.sch1.my_budget!GET_SERVICE_TYPE_USAGE_V2('2025-01', '2025-03');