Deploy Sigma's Snowflake Cost per Query template to see exactly what each workbook, user, role, and warehouse is spending — two setup steps and you have a live cost dashboard.
There are two steps to setting up the template:
query_history_enriched table in your Snowflake account
For more information on Sigma's product release strategy, see Sigma product releases.
Anyone who is trying to calculate the Snowflake cost-per-query or aggregate costs across different dimensions.
How to deploy Sigma's Snowflake Cost per Query template.

You will create the query_history_enriched table by running the attached SQL script in your Snowflake account.
This script creates a table called query_history_enriched that enriches the Snowflake query_history view with query cost information. It uses the warehouse_metering_history view to approximate the cost for every query run in your Snowflake account.
This approach incorporates warehouse idle time into query costs by spreading it proportionally over the queries. As such, the per-query credit and cost metrics may differ from the values you see in Snowflake's query_attribution_history view, which does not account for warehouse idle time. In aggregate, the cost per query from this model should tie out within a few percent to the values in warehouse_metering_history.
If you wish to use Snowflake's query_attribution_history and ignore warehouse idle time, you can make updates to the attached SQL script.
The script also sets up incremental materialization of the new query_history_enriched table so that it updates nightly.
The script requires you to specify a few parameters:
Run the SQL script in your Snowflake account, and then verify that you can see the new table(s) in the Sigma connection browser. 

Once you have created the query_history_enriched table, go to Sigma.
From the home page, navigate to the Templates section, then to External.
Click on the Snowflake Cost per Query template:

You will be prompted to swap data sources. Click Swap Now:

Verify that Sigma has found the query_history_enriched table and click Swap Now:

Click Save As and give your workbook a title.
That's all there is to it!
You should now see the Snowflake Cost per Query Template on top of your own data.
For example:


In this QuickStart, we created the query_history_enriched table and launched Sigma's Snowflake Cost per Query template.
If you're interested in a Snowflake Optimization tool, check out Select!
Additional Resource Links
Be sure to check out all the latest developments at Sigma's First Friday Feature page!
Help Center Home
Sigma Community
Sigma Blog
