Phase II updates or recreates statistics, taking into account the entries in the control table
DBSTATC .Standard call
sapdba -analyze DBSTATCO
The first call of
sapdba -analyze DBSTATCO uses the analysis method E to analyze all tables without statistics that are not in the control table DBSTATC The next analyze run creates the statistics of these tables with the correct analysis method.The
sapdba -analyze DBSTATCO call creates up-to-date statistics for all tables entered in the control table DBSTATC for which the TODO flag is set. sapdba -analyze NOOPTSTAT is called implicitly. If a table is already in the control table, the analysis method specified there is used; otherwise SAPDBA uses the analysis method adapted to the size of the table according to the SAPDBA internal rules.Syntax
sapdba
-u system/<password>
-analyze <tablespace | tablespace list | table | <keyword>>
-method E | C | EI | CI
-option R<n (*1000)> | P<n>
The command option correspond to those in phase I.
Key Words
DBSTATCO |
All tables for which the TODO flag is set in the control table DBSTATC , and all tables and indexes without statistics ( NOOPTSTAT ). |
NOOPTSTAT |
All tables and indexes without statistics (excluding pooled and cluster tables and tables in the control table DBSTATC with active = N or R ). |
analyze
is used for both the optimizer and for space analysis.The analysis method and option specified with the command option have no effect if the key word
DBSTATCO is used and an analysis method and option are entered for the appropriate tables.The method for the
analyze command is defined using two characters; the first is assigned to the tables and the second to the indexes. Since the optimizer always analyzes the indexes as well as the table, the second character must only be set if you want to analyze the indexes only, for example sapdba -analyze PSAP%I .The
-analyze logs are in the directory sapcheck/<timestamp>.aly .For more information, see:
CCMS Support for the Cost-Based Optimizer
SAPDBA Internal Rules for Determining Statistics for the CBO