Reputation: 59175
I'm looking at WAREHOUSE_EVENTS_HISTORY
, but I can't find a way to track the warehouse resizing values.
How can I get this data out of Snowflake?
(based on a customer question)
Upvotes: 3
Views: 900
Reputation: 59175
To track the resizing values you can join WAREHOUSE_EVENTS_HISTORY
with QUERY_HISTORY
on query_id
, and parse the 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'
If you are thinking about analyzing costs, check:
Upvotes: 4