Collecting inline statistics while loading a table

If you do not specify LOAD RESUME YES, you can use the STATISTICS keyword to gather inline statistics. In most cases, using the STATISTICS keyword eliminates the need to run RUNSTATS after loading a table space. However, if you perform a LOAD PART operation, you should run RUNSTATS INDEX on the nonpartitioned secondary indexes to update the catalog data about these indexes.

Procedure

To collect statistics while loading a table:

  1. Use the STATISTICS option to collect statistics so that the DB2® catalog statistics contain information about the newly loaded data:
    Option Description
    Collecting inline statistics for discarded rows If you specify the DISCARDDN option when you collect inline statics and a row is found with check constraint errors or conversion errors, the row is not loaded into the table. However, the LOAD utility collects inline statistics before it identifies the rows to discard. As a general rule, if the number of discarded rows is larger than 20 percent of the total number of rows in the table, , run the RUNSTATS utility separately on the table after running LOAD.
    Collecting inline statistics for data partitioned secondary indexes To collect inline statistics on data partitioned secondary indexes, you must allocate sort work data sets.

    If you perform a LOAD operation on a base table that contains an XML column, DB2 does not collect inline statistics for the related XML table space or its indexes.

    Recording these new statistics enables DB2 to select SQL paths with accurate information.
  2. Rebind any application plans that depend on the loaded tables to update the path selection of any embedded SQL statements.

What to do next

To collect statistics on the loaded table, you might need to invoke the RUNSTATS utility after the LOAD utility processing has completed.