Manual update of statistics

In case you have not enabled automatic statistic collection yet, but require to update table and index statistics right away, the easiest approach will be to run: $TOP/bin/db/analyze_schema.sh. This will update the statistics for all tables and indexes of the current Product Master schema.

Symptoms

If statistics are not up to date, performance could be compromised.

Environment

If you need to update statistics only for a limited number of tables, you might use:
On DB2:
RUNSTATS ON TABLE <schema>.<tablename> WITH DISTRIBUTION ON KEY COLUMNS AND INDEXES ALL
On Oracle:
Run within SQLplus: exec DBMS_STATS.GATHER_TABLE_STATS('<SCHEMANAME IN UPPERCASE>', '<TABLENAME IN UPPERCASE>', estimate_percent => 100, method_opt => 'FOR ALL COLUMNS SIZE AUTO', DEGREE => 2, cascade => TRUE);
Note: Ensure you abide by the following guidelines:
  • Specify the schema and table name in upper case letters.
  • Set the option cascade to TRUE. This will cause an update on index statistics as well.
  • For the estimate_percent parameter, use 100 for the full sampling.