The DB2® RUNSTATS command updates statistics in the system catalog about the characteristics of a table and/or associated indexes, or statistical views. It is highly recommended that you use the
DB2® RUNSTATS command to collect current statistics on tables and indexes, especially if significant update activity has occurred or new indexes have been created since the last time the
RUNSTATS command was run. This command provides the optimizer with the most accurate information with which to determine the best access plan.
To prevent this type of issue, consider declaring the table as volatile using the ALTER TABLE statement. By declaring the table volatile, the optimizer will consider using an index scan rather than a table scan. Access plans that use declared volatile tables do not depend on the existing statistics for that table.