1
votes

I've run into something I can't explain and I hope Snowflake support can help here...

The documentation for INFORMATION_SCHEMA views says there is no latency to display data in these views. https://docs.snowflake.com/en/sql-reference/account-usage.html#differences-between-account-usage-and-information-schema

However, storage allocation data is not available right away in this view - INFORMATION_SCHEMA.TABLE_STORAGE_METRICS.

I did some testing and I see it takes ~1-1.5 hrs to populate the view with storage info after my table was created, specifically, these columns - "active_bytes", "time_travel_bytes".

is this expected behavior for this view to display storage allocation data with latency ? or not ? where is the issue - documentation or snowflake views ?

here is a short description of my testcase

  1. table TEST_TABLE created under TEST database, PUBLIC schema ("normal" table, not transient, time travel retention parameter is set to 10 days)
  2. table populated with data, "TABLES" view shows its not empty - ~7.5 MB in there with ~130K rows
  3. switched to ACCOUNTADMIN role to have right access to required schema
  4. checked table INFORMATION_SCHEMA.TABLE_STORAGE_METRICS - "active_bytes", "time_travel_bytes" columns for the test table show zeros
  5. re-checked the view a few times - in ~1hr storage info showed up in these columns "active_bytes", "time_travel_bytes".

executed commands to query the views-

use role ACCOUNTADMIN;
select table_catalog, table_schema, table_name, table_type, is_transient, row_count,  bytes, retention_time from test.information_schema.tables where table_name = 'TEST_TABLE';
select table_catalog, table_schema, table_name, is_transient, active_bytes, time_travel_bytes from test.information_schema.table_storage_metrics where table_name = 'TEST_TABLE';
1
Yes, I too see this case. It took almost 1 hour to have the two columns populated with the values for a table that was created.Srinath Menon

1 Answers

0
votes

TABLE_STORAGE_METRICS is data leveraged for billing and Snowflake takes snapshot information for storage billing on a specific sampling rate, so I could see that the active bytes and time-travel bytes would not be populated in real-time. If you are looking for the real-time storage of a table, you should likely be leveraging the information_schema.tables view.