After many changes to table data,
logically sequential data might reside on nonsequential data pages,
so that the database manager might need to perform additional read
operations to access data. Also, if many rows have been deleted, additional
read operations are also required. In this case, you might consider
reorganizing the table to match the index and to reclaim space.
You can also reorganize the system catalog tables.
Because reorganizing a table usually takes more time than updating
statistics, you could execute the RUNSTATS command
to refresh the current statistics for your data, and then rebind your
applications. If refreshed statistics do not improve performance,
reorganization might help.
The following factors can indicate a need for table reorganization:
- There has been a high volume of insert, update, and delete activity
against tables that are accessed by queries.
- There have been significant changes in the performance of queries
that use an index with a high cluster ratio.
- Executing the RUNSTATS command to refresh table
statistics does not improve performance.
- Output from the REORGCHK command indicates
a need for table reorganization.
Note: With DB2® V9.7
Fix Pack 1 and later releases, higher data availability for a data
partitioned table with only partitioned indexes (except system-generated
XML path indexes) is achieved by reorganizing data for a specific
data partition. Partition-level reorganization performs a table reorganization
on a specified data partition while the remaining data partitions
of the table remain accessible. The output from the
REORGCHK command
for a partitioned table contains statistics and recommendations for
performing partition-level reorganizations.
REORG TABLE commands
and
REORG INDEXES ALL commands can be issued on
a data partitioned table to concurrently reorganize different data
partitions or partitioned indexes on a partition. When concurrently
reorganizing data partitions or the partitioned indexes on a partition,
users can access the unaffected partitions but cannot access the affected
partitions. All the following criteria must be met to issue REORG
commands that operate concurrently on the same table:
- Each REORG command must specify a different partition with the ON
DATA PARTITION clause.
- Each REORG command must use the ALLOW NO ACCESS mode to restrict
access to the data partitions.
- The partitioned table must have only partitioned indexes if issuing REORG
TABLE commands. No nonpartitioned indexes (except system-generated
XML path indexes) can be defined on the table.
In IBM® Data Studio Version
3.1 or later, you can use the task assistant for reorganizing
tables. Task assistants can guide you through the
process of setting options, reviewing the automatically generated
commands to perform the task, and running these commands. For more
details, see Administering databases with task assistants.