Find unused tables in Snowflake

Query below returns unused tables in a database what means tables which row count is equal to 0

Query

select table_schema,
       table_name,
       'IS EMPTY' as empty
from information_schema.tables
where row_count = 0
      and table_type = 'BASE TABLE'
order by table_schema,
         table_name;

Columns

  • table_schema - schema name
  • table_name - table name
  • empty - text indicating that the table is empty

Rows

  • One row represents one table in a database
  • Scope of rows: all unused tables in a database
  • Ordered by table schema, table name

Sample results

0
There are no comments. Click here to write the first comment.