Snowflake 是否跟踪仓库大小调整值?
Does Snowflake keep track of the warehouse resizing values?
我正在查看 WAREHOUSE_EVENTS_HISTORY
,但找不到跟踪仓库大小调整值的方法。
如何从 Snowflake 中获取这些数据?
(基于客户问题)
要跟踪调整大小的值,您可以在 query_id
上加入 WAREHOUSE_EVENTS_HISTORY
和 QUERY_HISTORY
,并解析 sql_text
:
use role accountadmin
;
select timestamp, event_state, a.user_name, a.role_name,
upper(regexp_substr(b.query_text, '(XSMALL|SMALL|MEDIUM|LARGE|XLARGE|XXLARGE|XXXLARGE|X4LARGE|X5LARGE|X6LARGE)', 1, 1, 'i')) as wh_size,
upper(regexp_substr(b.query_text, '(STANDARD|ECONOMY)', 1, 1, 'i')) as scaling_policy
from snowflake.account_usage.WAREHOUSE_EVENTS_HISTORY a
join snowflake.account_usage.QUERY_HISTORY b
on a.query_id = b.query_id
where a.event_name = 'ALTER_WAREHOUSE'
and a.timestamp > '2021-10-01'
- https://docs.snowflake.com/en/sql-reference/account-usage/warehouse_events_history.html
- https://docs.snowflake.com/en/sql-reference/account-usage/query_history.html
如果您正在考虑分析成本,请检查:
我正在查看 WAREHOUSE_EVENTS_HISTORY
,但找不到跟踪仓库大小调整值的方法。
如何从 Snowflake 中获取这些数据?
(基于客户问题)
要跟踪调整大小的值,您可以在 query_id
上加入 WAREHOUSE_EVENTS_HISTORY
和 QUERY_HISTORY
,并解析 sql_text
:
use role accountadmin
;
select timestamp, event_state, a.user_name, a.role_name,
upper(regexp_substr(b.query_text, '(XSMALL|SMALL|MEDIUM|LARGE|XLARGE|XXLARGE|XXXLARGE|X4LARGE|X5LARGE|X6LARGE)', 1, 1, 'i')) as wh_size,
upper(regexp_substr(b.query_text, '(STANDARD|ECONOMY)', 1, 1, 'i')) as scaling_policy
from snowflake.account_usage.WAREHOUSE_EVENTS_HISTORY a
join snowflake.account_usage.QUERY_HISTORY b
on a.query_id = b.query_id
where a.event_name = 'ALTER_WAREHOUSE'
and a.timestamp > '2021-10-01'
- https://docs.snowflake.com/en/sql-reference/account-usage/warehouse_events_history.html
- https://docs.snowflake.com/en/sql-reference/account-usage/query_history.html
如果您正在考虑分析成本,请检查: