这将最多延迟 3 小时,因为它是从 Snowflake 作为数据共享共享回来的。还有其他获取信息的方法,但对于当前状态,TABLE_STORAGE_METRICS 提供了有关时间旅行、故障保护等的更多信息。
select DATABASE_NAME
,sum(ACTIVE_BYTES / 1000000000) ACTIVE_GB
,sum(TIME_TRAVEL_BYTES / 1000000000) TIME_TRAVEL_GB
,sum(FAILSAFE_BYTES / 1000000000) FAILSAFE_GB
,sum(RETAINED_FOR_CLONE_BYTES / 1000000000) RETAINED_FOR_CLONE_GB
,ACTIVE_GB+TIME_TRAVEL_GB+FAILSAFE_GB+RETAINED_FOR_CLONE_GB TOTAL_GB
from SNOWFLAKE.ACCOUNT_USAGE.DATABASES D
left join SNOWFLAKE.ACCOUNT_USAGE.TABLE_STORAGE_METRICS T
on D.DATABASE_ID = T.TABLE_CATALOG_ID
where D.DELETED is null
group by DATABASE_NAME
order by DATABASE_NAME
;