Allocating Costs with Usage Groups

Usage Groups are a flexible way to attribute Snowflake spend in SELECT. Let's dive in.

Usage Groups are a flexible way to allocate costs in SELECT. With Usage Groups, you can flexibly allocate cost to teams, departments, project, or any bucket of your choice using a variety of Snowflake attributes such as User, Role, Warehouse, Object Tags, Database, or other query metadata.

Usage Group Sets vs. Usage Groups

Usage Group Sets are collections of Usage Groups. For example, we can create a Usage Group Set called “Team” and the individual Usage Groups can be “Finance”, “Accounting”, “HR”, etc. Other common examples of Usage Group Sets include “Department”, “Cost Center”, “Customer” or “Product”.

Creating Usage Group Sets

Before creating any Usage Groups, you need to first create a new Usage Group Set.

In the region above the chart, click “Usage Group Set”, then “Manage Sets”. Add a new name, then click “Done” and “Save”.

This gif demonstrates creating a new Usage Group Set. If you have not created one before, your page will look a little different, but the overall steps are similar.

How to create a Usage Group Set in SELECT to attribute Snowflake spend

Allocate Using dbt Metadata

Let’s say we want to attribute every dbt model and test executed in our environment to a specific business owners. The first step would be to follow our docs on leveraging dbt meta fields. Once the meta fields are set up in your dbt project, we are ready to create a Usage Group Set and Usage Groups.

Create the Set as shown above, then let’s create the Usage Groups. In this example we’ll create one Group for each Business Owner found in the dbt Meta, as shown here:

Create a Usage Group in SELECT to attribute Snowflake spend to teams

After the Usage Groups are created, visit the Workloads → dbt page, and change the “Group By” dimension on the chart to “Usage Group Set - dbt team”. Now the chart clearly shows which business owner is spending the most in Snowflake!

View trend chart of Snowflake Spend by flexible Usage Group in SELECT

In the table below, I can add a column for “Usage Group Set > dbt teams” to show each model along side the team name.

Add Usage Group column to a table in SELECT

Allocating Costs Using Snowflake Objects

One of the most popular ways of attributing cost is by using Snowflake Objects such as Warehouse, User, and Role for Compute and Database / Schema for Storage. In SELECT you can easily create usage groups based on any Snowflake Object.

Here’s an example of using several Snowflake Objects allocate cost to departments.

Allocate Snowflake costs by Object in SELECT

Allocating Costs Using Snowflake Object Tags

Another popular way of attributing costs is by Snowflake Object Tags. Assuming you have configured object tags in your account, search for the word “tag” in the Usage Group configuration where dropdown search. Here you can see that we can report on Warehouse, User, Role, or Database Tags.

Allocate Snowflake Cost by Object Tag in SELECT

All other aspects of creating the usage group remains the same.

Allocate Spend Using Other SELECT Workloads

Custom Workloads / Query Tag Metadata

If you’re not using dbt, you may want to allocate specific workloads by Query Tag or Query Comments using our Custom Workloads feature. Once you’ve configured the Custom Workloads, you can find them in the Usage Group configuration by typing the word “custom” in the where dropdown search.

Allocate Snowflake cost by Custom Workload or Query Tag Metadata in SELECT

Other Supported Workloads

You can also allocated spend to a Usage Group based on Tasks, Snowpipe, Dynamic Tables, Stored Procedures, Serverless Tasks, Looker User, Hex User, etc.

Reviewing Uncategorized Spend

In the chart screenshot above, you can see we have a small amount of uncategorized spend in our “dbt team” Usage Group Set, which means some model or test is missing the meta tag. Let’s isolate the problem by filtering to the "Uncategorized" data:

Review uncategorized (usage group) Spend in SELECT.

After getting the list of dbt assets that are missing the “business_owner” Meta in dbt, I update my dbt project to include the meta for those assets, then update the usage groups in SELECT. Don’t forget to create a Saved View and add a favorite to track uncategorized spend! The best practice is to make a habit of reviewing and eliminating uncategorized spend in Usage Groups.

Other Callouts with Usage Groups

There are a few things to keep in mind and explore about Usage Groups:

  • As seen in the demonstration above, Usage Groups can be added to the “group by” of any chart in SELECT or as a column in any table.
  • It is easy to monitor spend by Usage Groups by creating Monitors for each Usage Group Set.
  • Usage Groups can also be used for Role Based Access Control, as demonstrated in this usage guide.
  • For simpler ongoing management and version control, Usage Groups can be created and managed via Terraform or through our Usage Groups API.