了解预算成本

使用预算会产生以下成本:

  • Compute costs — Snowflake runs serverless background tasks (_MEASUREMENT_TASK and _BACKFILL_TASK) that collect credit usage data for the account budget and custom budgets in your account. The compute resources used for these tasks are billed to your account.
  • Storage costs — Snowflake stores metadata for Budgets in your account. Storage for this metadata is billed to your account.

了解计算成本

You can view costs for serverless tasks using Snowsight or the Account Usage SERVERLESS_TASK_HISTORY view.

Note

The _MEASUREMENT_TASK task runs when you add or remove object tags, which incurs cost for the serverless compute needed to run the task.

Example: Compute cost of all budgets

以下示例汇总了过去 28 天度量任务的 Credit 使用量:

SELECT SUM(credits_used)
   FROM snowflake.account_usage.serverless_task_history
   WHERE task_name = '_MEASUREMENT_TASK'
     AND start_time >= DATEADD('day', -28, current_timestamp());
Example: Compute cost of individual budgets

以下示例返回与当前账户中预算相关的内部表所使用的存储空间总和:

WITH costs AS (
  SELECT instance_id, SUM(credits_used) AS sum_credits
    FROM snowflake.account_usage.serverless_task_history
    WHERE start_time >= DATE_TRUNC('month',  CURRENT_TIMESTAMP())
      AND instance_id IS NOT NULL
   GROUP BY 1)
SELECT ci.name, ci.schema_name, ci.database_name, costs.sum_credits
FROM snowflake.account_usage.class_instances ci
  JOIN costs
    ON costs.instance_id = ci.id
WHERE class_name = 'BUDGET' AND class_database_name = 'SNOWFLAKE' AND deleted IS NULL;

了解存储成本

预算所需的数据和元数据存储在以下内部表中:

  • _CONFIGURATION_TABLE
  • _MEASUREMENT_TABLE
  • _NOTIFICATION_TABLE
  • _BUDGET_HOT_USAGE_DATA
  • _BUDGET_COLD_USAGE_DATA
  • _BUDGET_CUSTOM_ACTIONS

要确定与这些表相关的成本,您可以在“Account Usage”或“Organization Usage”架构中查询 TABLES 视图,以返回用于这些表的存储量。

以下示例返回与当前账户中预算相关的内部表所使用的存储空间总和:

SELECT SUM(bytes)
   FROM snowflake.account_usage.tables
   WHERE table_name IN (
      '_CONFIGURATION_TABLE',
      '_MEASUREMENT_TABLE',
      '_NOTIFICATION_TABLE',
      '_BUDGET_HOT_USAGE_DATA',
      '_BUDGET_COLD_USAGE_DATA');