8.8.1 Example

This section presents an example of using the database reorganization utility (reorganizing indexes).

Example 1
This example reorganizes the indexes (INDEX1 and INDEX2) defined for a table (TABLE1).
The example assumes that the following table and indexes have been defined:
  • Table definition:

CREATE TABLE TABLE1(C1 INT NOT NULL,C2 CHAR(8),C3 INT)
              IN ((PDBUSER01) C1 > 10,(PDBUSER02))

  • Index definition (partitioning key index):

CREATE INDEX INDEX1 ON TABLE1(C1)
              IN ((PDBUSER03),(PDBUSER05))

  • Index definition (non-partitioning key index):

CREATE INDEX INDEX2 ON TABLE1(C2,C1)
              IN ((PDBUSER04),(PDBUSER06))

Overview
[Figure]
Relationship between input/output files and RDAREAs
[Figure]
Explanation of the command
This example reorganizes the indexes (INDEX1 and INDEX2) defined for a table (TABLE1).
-k ixor: Specification for index reorganization
-t TABLE1: Name of the table subject to index reorganization
control_file: Name of the control information file
Contents of the control information file (control_file)

idxname name=*                              1
idxwork bes1 /usr/idx_file                  2
idxwork bes2 /usr/idx_file                  2

Explanation:
  1. Specifies index reorganization in units of indexes:
    *: Specification for reorganizing all indexes defined for the table (TABLE1)
  2. Specifies the directory for index information files:
    bes1, bes2: Names of the servers used to create index information
    /usr/idx_file: Name of the directory in which index information files are created