Performance Monitoring and Tuning · Topic 15 of 16

Budgets, Warehouse Monitoring and Automatic Clustering Cost

Use Snowflake Budgets for credit alerts, warehouse monitoring data to cut cost, and AUTOMATIC_CLUSTERING_HISTORY to assess automatic clustering usage.

  • 5 min
In a nutshell
  • Budget: monthly credit limit, alerts only, forecast based, account or custom.
  • Default budget refresh is up to 6.5 hours; the one hour tier costs 12 times as much.
  • Budgets cover serverless features; resource monitors cover warehouses.

What it is

Three tools help an administrator keep spend predictable. Budgets warn when credit use is on track to pass a monthly limit. Warehouse monitoring data shows whether warehouses are sized and suspended sensibly. Automatic clustering monitoring shows what serverless reclustering costs.

Each answers a different question, and the exam likes to mix them up: a budget alerts, a resource monitor can suspend warehouses, and only the budget also covers serverless reclustering.

Spendcreditsforecast against limitBudgetalert onlywarehouse detailMonitoring viewsload and meteringserverless detailAUTOMATIC_CLUSTERING_HISTORY

How it works

Budgets

A budget sets a monthly spending limit in credits on compute cost. It has two forms:

BudgetScope
Account budgetAll compute cost of the account
Custom budgetA group of supported objects that you choose, by name or by tag

The limit is used for alerting and notification only. A budget never suspends anything.

  • The period runs from 12:00 AM UTC on the first day of the month to 11:59 PM UTC on the last day.
  • A budget sends a daily alert when spending is projected to exceed the limit, based on a forecast.
  • Notifications go to email addresses, a cloud queue (Amazon SNS, Azure Event Grid, Google Cloud Pub/Sub) or a webhook such as Slack, Microsoft Teams or PagerDuty.
  • Custom actions can run stored procedures when spending reaches a threshold, or when the cycle restarts.
  • You must set a spending limit and a notification method.
  • Activating an account budget mid month backfills data from the start of the month. For a custom budget, backfill covers only resources added by tag.
  • The default refresh interval is up to 6.5 hours. A one hour refresh, called a low latency budget, raises the compute cost of the budget by a factor of 12. SET_REFRESH_TIER changes it.
  • Budgets cover warehouses and serverless features such as serverless tasks, materialized views, pipes, replication, query acceleration, Snowpark Container Services and Cortex related AI services.

Roles:

Budget typeRoles
Account budgetApplication roles BUDGET_VIEWER and BUDGET_ADMIN
Custom budgetInstance roles VIEWER and ADMIN

Creating a custom budget needs the SNOWFLAKE.BUDGET_CREATOR database role and CREATE SNOWFLAKE.CORE.BUDGET on the schema. The APPLYBUDGET privilege is required on each object you add. An account can have up to 100 custom budgets, and budget instances cannot be replicated.

Exam tip

The question "alert before the month's credits run out, covering serverless as well as warehouses" is a budget. The question "suspend a warehouse when it reaches its quota" is a resource monitor.

Budgets against resource monitors

PointBudgetResource monitor
MeasuresCredits for warehouses and serverless featuresCredits used by warehouses
ActionNotification and custom actionsNotify, suspend, or suspend immediately
PeriodCalendar month, UTCChosen frequency and start time
ScopeAccount or custom groupAccount or assigned warehouses

Resource monitors cannot cap serverless features such as automatic clustering, which is why a budget is the tool for them.

Warehouse monitoring to cut cost

The syllabus item names the data you use to judge warehouse efficiency. In practice you read these sources:

SourceWhat it showsCost action
WAREHOUSE_METERING_HISTORYCredits per hour, compute against attributed to queriesFind idle time, lower auto suspend
WAREHOUSE_LOAD_HISTORYAverage running, queued and blocked queriesLow load means shrink; steady queuing means more clusters
WAREHOUSE_EVENTS_HISTORYSuspend, resume, resize and cluster eventsFind warehouses that resume constantly
QUERY_HISTORYQueue time, spilling and runtime per querySize up only where spilling or long runtimes justify it
Snowsight monitoring pagesThe same signals as chartsQuick checks

Reading the signals:

  • Warehouse mostly idle with low load: reduce size or auto suspend, or merge with another warehouse.
  • Queued queries and no spilling: add clusters on a multi cluster warehouse.
  • Spilling to local or remote storage: a larger size gives more memory.
  • Many resume events a day with few queries: auto suspend is too short, or something keeps polling.

Automatic clustering usage

Automatic Clustering is a serverless feature (available in all editions) that reclusters tables that have a clustering key. It runs in the background and is billed as credits to the account, not to a warehouse.

ItemDetails
ViewACCOUNT_USAGE.AUTOMATIC_CLUSTERING_HISTORY
Key columnsCREDITS_USED, NUM_BYTES_RECLUSTERED, NUM_ROWS_RECLUSTERED, table name
Table functionINFORMATION_SCHEMA.AUTOMATIC_CLUSTERING_HISTORY
EstimateSYSTEM$ESTIMATE_AUTOMATIC_CLUSTERING_COSTS
Pause and resumeALTER TABLE ... SUSPEND RECLUSTER and RESUME RECLUSTER
SELECT table_name, SUM(credits_used) AS credits,
       SUM(num_bytes_reclustered) AS bytes
FROM snowflake.account_usage.automatic_clustering_history
WHERE start_time >= DATEADD('day', -30, CURRENT_TIMESTAMP())
GROUP BY table_name
ORDER BY credits DESC;

What drives the cost:

  • Table size and how much data changes. Frequent inserts, updates and deletes disturb the order and trigger reclustering.
  • The choice of clustering key. A key with very high cardinality, or one that does not match the filters, causes costly work for little benefit.
  • Each rewrite creates new micro partitions, so Time Travel and Fail-safe storage grows as well.

To assess it, compare the credits for each table with the query speedup it gives, and suspend reclustering on tables where it does not pay off.

Table with clustering keyfrequent DMLreclusteringServerless creditsAUTOMATIC_CLUSTERING_HISTORYtoo costly?SUSPEND RECLUSTERor change the key

Common mistakes

Thinking a budget stops spending. It only alerts and can run custom actions.

Using a resource monitor to cap automatic clustering. Resource monitors apply to warehouses, not serverless features.

Looking for clustering cost in WAREHOUSE_METERING_HISTORY. It is serverless; use AUTOMATIC_CLUSTERING_HISTORY.

Forgetting the storage side. Reclustering also adds Time Travel and Fail-safe bytes.

What to remember for the exam

  • Budget: monthly credit limit, alerts only, forecast based, account or custom.
  • Default budget refresh is up to 6.5 hours; the one hour tier costs 12 times as much.
  • Budgets cover serverless features; resource monitors cover warehouses.
  • Automatic Clustering is serverless, bills to the account, and is tracked in AUTOMATIC_CLUSTERING_HISTORY.
  • Pause with SUSPEND RECLUSTER.

Check yourself

  • Which tool alerts when forecast spend will pass a monthly credit limit?

    A budget, which sends notifications and never suspends anything.

  • Which view shows credits used by automatic clustering per table?

    AUTOMATIC_CLUSTERING_HISTORY.

  • Why does a heavily updated clustered table cost more to maintain?

    Changes disturb the clustering, so more reclustering runs and more serverless credits are used.

Topic 15 of 16 in Performance Monitoring and Tuning

Test yourself on Performance Monitoring and Tuning

The full Snowflake ADA-C02 question bank has 814 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Snowflake. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.