Using SELECT

Workloads

Overview

SELECT helps Snowflake users understand their usage by categorizing SQL queries into workloads. By calculating the cost of each query in a workload, SELECT can surface your top consumption drivers. This helps customers prioritize optimization efforts and ensure they are effectively using Snowflake.

SELECT workloads

Types of Workloads

Query Patterns

By default, SELECT categorizes all queries into individual "Query Pattern" workloads. All queries are run through a custom query parser which standardizes the SQL into a recurring Query Pattern. In the example below, literals in the where filters are stripped out in each query, resulting in both queries being matched to the same pattern.

SELECT Snowflake query parser

By analyzing the cost of Query Patterns instead of individual queries, users can spot frequently running queries that add up in cost.

SELECT Snowflake Query Patterns

Each Query Pattern has a dedicated page where SELECT users can see an overview, costs and performance statistics over time, and the full query history.

SELECT Snowflake Query Pattern page

Metadata-Based Workloads

One of the downsides of Query Patterns is that structural changes to the SQL text will result in a new Query Pattern being created. This can make it difficult to understand the impact of changes to a query that is associated with a business process. Additionally, users must analyze the query text, username and warehouse of a Query Pattern to understand what system or business process it is a part of.

To support this, SELECT has created several different metadata-based workloads. Instead of grouping queries that have the same underlying SQL pattern, SELECT leverages query comments and query tags. This allows for a more natural and flexible grouping of queries. For example, a given Looker dashboard can consist of 50 different queries that run every time the dashboard is refreshed. The individual queries can be cheap, but, when grouped, quite expensive.

SELECT Looker integration dashboard overview

Similar to Query Patterns, each workload has a dedicated page with cost & performance trends, and optimization insights.

The following is a list of metadata-based workloads supported by SELECT:

  • Custom Workloads: add your own tags / comments to queries running in your account
  • dbt: understand the cost of all dbt resources (models, tests) and analyze your run performance
  • Fivetran: analyze the compute costs from Fivetran loading each table into your account
  • Analyze the cost of each dashboard or business user in your BI Tools:

Serverless Workloads

SELECT also surfaces the cost of different serverless workloads running in Snowflake:

  • Automatic Clustering
  • Snowpipe
  • Serverless Tasks (coming soon)
  • Database Replication (coming soon)