Search code examples
db2db2-luw

DB2 Identify unused index


Is it possible to identify unused indexes? In our database we have a lot of indexes in the meanwhile. So it will be helpful when it will exist a system table to figure out these indexes.


Solution

  • Check out the LASTUSED column for view SYSCAT.INDEXES for currently supported versions of Db2-LUW and take care to fully understand the caveats mentioned here.

    Date when the index was last used by any DML statement to perform a scan, or used to enforce referential integrity constraints. This column is not updated when the index is used on an HADR standby database, nor is it updated when rows are inserted into the table on which the index is defined. The default value is '0001-01-01'. This value is updated asynchronously not more than once within a 24 hour period and might not reflect usage within the last 15 minutes.