IBM Books

Administration Getting Started


Step 4. Collecting Statistics

Statistics describe the physical and logical characteristics of a table and its indexes. You must collect table and index statistics periodically for each table. These statistics are used by DB2 to determine a good way to access the data. If the data has changed significantly, to the extent that the information last collected no longer reflects the actual table data, then performance may begin to deteriorate when users are accessing data.

You should re-bind application programs that use static SQL after collecting statistics, because the SQL optimizer may choose a different access plan given the new statistics. In particular, you should re-bind those programs that reference tables for which new statistics are available. See the Quick Beginnings for your platform for instructions on binding application programs.

How Do I Collect Statistics?

To collect statistics for tables and indexes together:

  1. Open the Run Statistics window:

    1. From the Control Center, expand the object tree until you find the Tables folder.

    2. Click on the Tables folder. Any existing tables are displayed on the right side of the window (the contents pane).

    3. Click mouse button 2 on the table you want, and select Run Statistics from the pop-up menu. The Run Statistics window opens.

  2. Specify the level of statistics you want to gather for the table, by selecting a radio button under Statistics for the table.

  3. Specify the level of statistics you want to gather for the table's indexes, by selecting a radio button under Statistics for the indexes.

  4. Use the Share level radio buttons to specify the type of access you want other users to have to the table while the statistics are being collected:

  5. Click on OK to begin collecting statistics.

Additional options exist. See the online help accessible from the Run Statistics window.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]