Use
You can use this procedure to check and update statistics for the Oracle cost-based optimizer (CBO), resulting in improved database performance. This section describes the new integrated SAPDBA approach for update statistics, which you start from the command line. It uses parallel processing to reduce the time taken to update statistics: the father process starts child processes to perform the optimizer analyses for individual tables, and communication between father and child uses pipes.
We strongly recommend you to use the
Here is the detailed command syntax to update statistics with SAPDBA:
sapdba
-statistics ALL | DBSTATCO | <tables>
[ -method E | C | EH | CH
-option Pn | Rn ]
The command is explained in the procedure below.
For an overview of update statistics for the Oracle database, see
Update Statistics for the Cost-Based Optimizer with SAPDBA.Prerequisites
The number of parallel child processes is determined by the
The operation log is stored in the
Procedure
sapdba -statistics
This is the usual command, which is equivalent to the following with the previous two-phase method:
sapdba -checkopt PSAP%
sapdba -analyze DBSTATCO
You can add the switch
ALL to the command sapdba -statistics , but it is no longer necessary.SAPDBA:
SAPDBA deletes the statistics on tables that do not need statistics. These include all R/3 pool and cluster tables as well as all tables listed in the
SAPDBA proceeds as follows:
SAPDBA examines the primary index of each table to see how many records have changed. The analysis method used to see how many records have changed is described in
If enough records in a table have changed, SAPDBA updates statistics for the table. The criteria that SAPDBA uses to decide whether enough records have changed are described in
SAPDBA does not update statistics for the following tables:
SAPDBA generates statistics by analyzing the primary index using the method "Estimate Statistics Sample 1 Percent." The next time that you run update statistics with SAPDBA, it handles the table like any other table.
SAPDBA updates statistics for all tables in the
The criteria that SAPDBA uses to decide whether enough records have changed are described in
sapdba -statistics DBSTATCO
SAPDBA follows the rules given in "Updates statistics for tables listed in the
DBSTATC table" in the previous step.sapdba -statistics <tables>
You can specify
<tables> using the name of a single table or a wildcard (for example, psap* ).SAPDBA proceeds as described for
sapdba -statistics (see the first step above) for the table or tables that you specify.sapdba -statistics ALL -method E -option P10
The methods and options are as follows:
Result
The database statistics are up-to-date, resulting in better performance.