Find empty tables in Db2 database

This query returns list of tables in a database without any rows.


select tabschema || '.' || tabname as table
from syscat.tables
where card = 0
      and tabschema not like 'SYS%'
order by table;


  • table - table name with schema name


  • One row represents one table
  • Scope of rows: only empty tables (without rows)
  • Ordered by schema and table name


Number of rows may be not up to date as it's taken from DB2 statistics. Statistics must be updated after tables has had many updates, or after reorganizing any of the tables. You can do it with RUNSTATS command.

Sample results

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
There are no comments. Click here to write the first comment.