Snowflake snippets
How to find the average daily space used for storage in the last 7 days
If you want to query the Information Schema to find for each database, the amount of space used for storage data in the last 7 days you can use the following query
SELECT *
FROM TABLE (
INFORMATION_SCHEMA.database_storage_usage_history
(DATEADD('days', -7, CURRENT_DATE()), CURRENT_DATE())
);

If you want to just extract the storage statistics about a specific database (for instance 'JOB_DATASET'
), you can personalize the query as the following
SELECT *
FROM TABLE(
INFORMATION_SCHEMA.database_storage_usage_history
(DATEADD('days',-7,CURRENT_DATE()),CURRENT_DATE(),'JOB_DATASET')
);
