Find the time when table was last accessed in Db2 database

Article for: SQL Server Teradata Vertica

Query below returns list of tables and their last using date.


select tabschema || '.' || tabname as table,
       lastused as last_used,
from syscat.tables
where tabschema not like 'SYS%'
      and type = 'T'
order by lastused desc;


  • table - name of the table schema
  • last_used - date of last table use in DDL query
  • create_time - time at which the table was created.
  • alter_time - time at which the table was last altered.


  • One row represents one table in database
  • Scope of rows: all tables in database
  • Ordered by last used date

Sample results

sample results

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