When Db2 externalizes real-time statistics

In-memory statistics for Db2 objects are written to Db2 catalog tables at a specified interval, and in other certain situations.

Db2 uses an asynchronous task to externalize the in-memory statistics to the real-time statistics tables. To accomplish this task, Db2 completes the following actions:
  1. Examines the in-memory statistics.
  2. Calculates the new total values.
  3. Updates the real-time statistics tables.
  4. Resets the in-memory statistics

Db2 externalizes real-time statistics in the following situations:

  • At the end of the time interval that you specify during installation in the value of the STATSINT subsystem parameter.
  • During utility operations. Some utilities modify the statistics tables.
  • When you issue the ACCESS DATABASE command and specify the MODE(STATS) option, Db2 externalizes real-time statistics for the specified objects. You can use this method to externalize the real-time statistics immediately, before your invoke processes that depend on the accuracy of the real-time statistics values, such as the DSNACCOX stored procedure.
  • When you issue START DATABASE or STOP DATABASE commands. These commands externalize statistics only for the databases and table spaces that are specified by the commands. No statistics are externalized when the DSNDB06 database is stopped.
  • When you issue the STOP Db2 command. Db2 writes any statistics that are in memory to the statistics tables when you issue this command.

Db2 does not externalize real-time statistics in the following situations:

  • When Db2 is started with the ACCESS(MAINT) option and the DEFER ALL option is in effect. In this case, all statistics changes are lost.
  • During certain migration operations, such as CATMAINT utility processing. Db2 issues message DSNT5371I to indicate the status of RTS externalization for these operations.
  • When objects are in a UTUT, UTRO, or UTRW state.
  • At a tracker site.

If any objects that are required for externalization of real-time statistics are unavailable, Db2 issues message DSNT535I or message DSNT536I to provide more information about the unavailable resources.

Because Db2 holds locks when it externalizes real-time statistics, timeout and deadlock situations are possible when two processes attempt to externalize real-time statistics simultaneously. For example, such timeouts or deadlocks might occur if you issue a STOP DATABASE command when Db2 is already externalizing real-time statistics at the end of the interval specified by the STATSINT subsystem parameter.