Best practices | Collecting statistics


Reorganizing data in tablespaces


+

Search Tips   |   Advanced Search


When a high number of inserts, updates, or deletes have been issued against a table in the database, the physical placement of the rows and related indexes may not be optimal. DB2 provides a utility to reorganize data for a table:

db2 REORG TABLE <tabschema>.<tabname>;

DB2 also provides a utility to check whether a table or index data needs to be organized. While connected to a database, the following command can be issued:

db2 REORGCHK

This command checks all tables in the database and produces a listing, first by table and second by index. In the listing, an asterisk (*) in any of the last three columns implies that the table or index requires a REORG.