page126
109
You should also be aware of the summary database-level information for the past
year, which can be found within the Account Usage Store as this next SQL statement
illustrates:
SELECT usage_date,
database_name AS db_name,
average_database_bytes /1024/1024/1024 AS avg_db_GB,
average_database_bytes /1024/1024/1024/1024 AS avg_db_TB,
average_failsafe_bytes /1024/1024/1024 AS avg_fs_GB,
average_failsafe_bytes /1024/1024/1024/1024 AS avg_fs_TB,
deleted
FROM snowflake.account_usage.database_storage_usage_history
ORDER BY usage_date DESC;
Figure 4-1 shows some sample output for my TPC database; note that this view has
up to three hours latency.
Figure 4-1.
Database average storage consumption
You can find more information on the Account Usage
database_storage_usage_
history
view at
https://docs.snowflake.com/en/sql-reference/account-usage/
database_storage_usage_history
.
Snowflake also supplies a table function referencing the
information_schema
, useful
for live, point-in-time investigations as
information_schema
views hold data for only
14 days. You can find further information at
https://docs.snowflake.com/en/sql-
reference/functions/database_storage_usage_history
. I leave this for your later
investigation.
ChaPTer 4
MiCro-ParTiTionS