This query returns a list of all tables with no rows.
select n.nspname as table_schema, c.relname as table_name from pg_class c join pg_namespace n on n.oid = c.relnamespace where c.relkind = 'r' and n.nspname not in ('information_schema','pg_catalog') and c.reltuples = 0 order by table_schema, table_name;
- table_schema - table's schema name
- table_name - table name
- One row represents one table
- Scope of rows: all tables without any rows
- Ordered by schema and table name
Empty tables in our pagila repository: