Query below returns tables in a database with space (MB accessed by a scan of the table) they use ordered from the ones using most.
round(bytes/1024/1024, 2) as table_size
where table_type = 'BASE TABLE'
order by table_size desc;
- table_schema - name of table schema
- table_name - name of table
- table_size - space used by table in MB
- One row represents one table in a database
- Scope of rows: all tables in a database
- Ordered by table used size from largest to smallest
Tables in SNOWFLAKE_SAMPLE_DATA ordered from the ones using most space to least.