DB2 10.5 for Linux, UNIX, and Windows

ANALYZE_DATABASE procedure - Gather statistics on tables, clusters, and indexes

The ANALYZE_DATABASE procedure provides the capability to gather statistics on tables, clusters, and indexes in the database.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-DBMS_UTILITY.ANALYZE_DATABASE--(--method--------------------->

>--+--------------------------------------------------------------+-->
   '-,--estimate_rows--+----------------------------------------+-'   
                       '-,--estimate_percent--+---------------+-'     
                                              '-,--method_opt-'       

>--)-----------------------------------------------------------><

Parameters

method
An input argument of type VARCHAR(128) that specifies the type of analyze functionality to perform. Valid values are:
  • ESTIMATE - gather estimated statistics based upon on either a specified number of rows in estimate_rows or a percentage of rows in estimate_percent;
  • COMPUTE - compute exact statistics; or
  • DELETE - delete statistics from the data dictionary.
estimate_rows
An optional input argument of type INTEGER that specifies the number of rows on which to base estimated statistics. One of estimate_rows or estimate_percent must be specified if the method is ESTIMATE. The default value is NULL.
estimate_percent
An optional input argument of type INTEGER that specifies the percentage of rows upon which to base estimated statistics. One of estimate_rows or estimate_percent must be specified if the method is ESTIMATE. The default value is NULL.
method_opt
An optional input argument of type VARCHAR(1024) that specifies the object types to be analyzed. Any combination of the following keywords are valid:
  • [FOR TABLE]
  • [FOR ALL [ INDEXED ] COLUMNS ] [ SIZE n ]
  • [FOR ALL INDEXES]
The default is NULL.

Authorization

EXECUTE privilege on the DBMS_UTILITY module.