16.6. Lack of Proper Maintenance

There are two important database maintenance operations that you need to perform on a regular basis.

  • Reorganize your tables and indexes as they become unclustered due to INSERT, UPDATE, and DELETE statements.

  • Keep the statistics on your tables and indexes current, especially as you add, change, or remove data from your tables.

The DB2 optimizer uses the statistics about your tables and indexes when it is building the access plan for the statements executed by your applications. If the statistics are out of date or show that the data is not clustered according to the indexes you have defined on the tables, the optimizer cannot choose the most efficient access plan.

Statistics about your database objects are stored ...

Get Understanding DB2®: Learning Visually with Examples now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.