Database maintainance utilities(3)
The RUNSTATS Utility:
This
utility command can use be used to collect table and index statistics to build
efficient access plans. The basic command syntax for RUNSTATS is:
RUNSTATS ON TABLE [TableName]
USE
PROFILE
<UTIL_IMPACT_PRIORITY
[Priority]>
You
could also use this version of the command:
RUNSTATS
ON TABLE [TableName] FOR
<<SAMPLED>
DETAILED>
[INDEXES
| INDEX]
[[IndexNames]
| ALL]
<EXCLUDING
XML COLUMNS>
<ALLOW
READ ACCESS | ALLOW WRITE ACCESS>
<SET
PROFILE NONE | SET PROFILE <ONLY> | UPDATE PROFILE
<ONLY>>
<UTIL_IMPACT_PRIORITY
[Priority]>
You
could also use this version of the command:
RUNSTATS
ON TABLE [TableName]
<ON
ALL COLUMNS |
ON
KEY COLUMNS> |
ON
COLUMNS [ColumnNames] |
ON
ALL COLUMNS AND COLUMNS [ColumnNames] |
ON
KEY COLUMNS AND COLUMNS [ColumnNames]>
<WITH
DISTRIBUTION>
<EXCLUDING
XML COLUMNS>
<AND
<<SAMPLED> DETAILED>
[INDEXES
| INDEX]
[[IndexNames]
| ALL]>
<EXCLUDING
XML COLUMNS>
<ALLOW
READ ACCESS | ALLOW WRITE ACCESS>
<SET
PROFILE NONE | SET PROFILE <ONLY> | UPDATE PROFILE
<ONLY>>
<UTIL_IMPACT_PRIORITY
[Priority]>
Consider
the following:
TableName:
Identifies the name of the table for which to collect statistical information
IndexNames:
Identifies the names indexes for which to collect statistical information
ColumnName:
Identifies the column names for which to collect statistical information
Priority:
Specifies to throttle the RUNSTATS utility
RUNSTATS
command has various options, and a few of them are listed here:
Can
be executed with a specific rate (throttled) using the UTIL_IMPACT_PRIORITY
setting
Can
collect statistics based on the profile created before
Can
collect statistics for individual columns in a table
Can
collect statistics on all indexes for a table
Can
collect statistics with a table and index sample percentage
If
you want to collect statistics on the table DB2INST1.EMPLOYEE and associated
indexes based on a 25% sampling rate, you can execute the following command:
RUNSTATS
ON TABLE db2inst1.employee ON ALL COLUMNS AND INDEXES ALL TABLESAMPLE SYSTEM
(25.000000) INDEXSAMPLE SYSTEM (25.000000);
DB20000I The
RUNSTATS command completed successfully.
Similarly,
if you want to collect statistics on the table DB2INST1.EMPLOYEE and only two
of its indexes, with a sampling rate of 10%, you can execute the following
command:
RUNSTATS
ON TABLE db2inst1.employee AND SAMPLED DETAILED INDEXES db2inst1.ix1_employee,
db2inst1.ix2_employee TABLESAMPLE SYSTEM (10.000000) INDEXSAMPLE SYSTEM
(10.000000);
DB20000I The
RUNSTATS command completed successfully.
Comments
Post a Comment