WAREHOUSE_METERING_HISTORY 视图 (ACCOUNT_USAGE):新列

Attention

This behavior change is in the 2024_08 bundle.

For the current status of the bundle, refer to Bundle History.

When this behavior change bundle is enabled, the Account Usage WAREHOUSE_METERING_HISTORY view includes the following new column:

Column nameData typeDescription
CREDITS_ATTRIBUTED_COMPUTE_QUERIESNUMBER

每小时分配给查询的 Credit 数。

仅包括查询执行所用的 Credit,不包括任何仓库空闲时间使用的 Credit。

使用说明

  • 该列的延迟时间最长可达 6 小时。
  • Warehouse idle time is not included in the CREDITS_ATTRIBUTED_COMPUTE_QUERIES column. See Examples for a query that calculates the cost of idle time.

示例

例如,要确定过去 10 天内每个仓库的空闲时间成本,请执行以下语句:

SELECT (
   SUM(credits_used_compute) -
   SUM(credits_attributed_compute_queries)
) AS idle_cost,
    warehouse_name
 FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
    WHERE start_time >= DATEADD('days', -10, CURRENT_DATE())
          AND end_time < CURRENT_DATE()
    GROUP BY warehouse_name;

参考:1714