Reorganize a table using iSeries Navigator

This topic shows how to reorganize a table using iSeries™ Navigator and shows the options that you can specify on the Reorganize window.

Reorganizing a table restores the table to its ideal physical organization. The ideal organization for a database table is for its rows to be laid out on pages, ordered by their key values in some frequently used index. You can reorganize a table by compressing out deleted records, by table key, or by a selected index.

To reorganize a table using iSeries Navigator, follow these steps:

  1. From iSeries Navigator, expand the system you want to use.
  2. Expand Databases.
  3. Expand the database folder that you want to work with.
  4. Expand the Schemas folder.
  5. Click the schema that contains the table you want to reorganize.
  6. Click Tables.
  7. In the detail pane, right-click the table you want to reorganize and select Reorganize.
On the Reorganize window, select one of the following options to specify how the rows are reorganized in the table:
  • By compressing out deleted rows without preserving the arrival row sequence: specify that valid rows at the end of the table are moved to deleted rows until no deleted rows remain.
  • By compressing out deleted rows and preserving the arrival row sequence: specify that all valid rows after the first deleted row in the table are moved forward in the table to compress out any deleted rows.
  • By table key: specify that the rows of the table are rearranged by the key values of the table's access path. The table must have a primary key or must be a keyed physical file.
  • By a selected index from library: specify that the rows of the table are rearranged by the key values of an index or keyed logical file that is built over the specified table. You can select only an existing index. Your list of indexes is determined by the library you select.
You can specify other options on the Reorganize window to control performance and concurrency of the reorganize operation:
  • Specify which partition of a partitioned file (or which member of a multiple member physical file) should be reorganized
  • Specify whether the reorganize operation can be suspended and subsequently restarted.

    If you do not specify that the reorganize operation can be suspended, the table will be allocated exclusively for the duration of the reorganize operation and can only be suspended by ending the job immediately.

    If you specify that the reorganize can be suspended:
    • The file must be journaled since the rows are moved under commitment control to ensure that no rows are lost if the reorganize operation is suspended.
    • You can also specify whether other users can read the table or change the table during the reorganize operation. Locks are acquired for short periods of time on rows that are moved during the reorganize. If concurrent jobs also acquire locks on rows, record lock time-outs might occur. You can change the record lock wait time for the file, or you can use the Override with Database File (OVRDBF) command to specify an appropriate record wait time.
  • Specify how indexes are maintained:
    • If you specify that the reorganize operation can be suspended, you can also specify that all indexes should be maintained during the reorganize operation. No index rebuilds are necessary.
    • Otherwise, you can specify that indexes be rebuilt synchronously or asynchronously. You can see the progress of asynchronously built indexes by using the Edit Rebuild of Access Paths (EDTRBDAP) command.
Related concepts
Lock records