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.
Query
select table_schema,
table_name,
round(bytes/1024/1024, 2) as table_size
from information_schema.tables
where table_type = 'BASE TABLE'
order by table_size desc;
Columns
- table_schema - name of table schema
- table_name - name of table
- table_size - space used by table in MB
Rows
- 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
Sample results
Tables in SNOWFLAKE_SAMPLE_DATA ordered from the ones using most space to least.