Harjit is a DB2 LUW support analyst that has been with the DB2 support team since 2000. As well as his DB2 LUW skills Harjit is also knowlegeable on Datalinks and BCU.

Over the years we have had many questions about when or how often should a reorg be run on tables in a database.

Runstat and reorgchk should be run on a regular basis.. whereas reorg on tables should be run on an as needed basis depending on the output from reorgchk.

Rerogchk can be run with option

For more command options check the reorgchk command options.

Now, how to make a descision if a reorgchk needs to be run or not.

In the output depending on the table statistics and index statistics output

REORG

Each hyphen (-) displayed in this column indicates that the calculated results were within the set bounds of the corresponding formula, and each asterisk (*) indicates that the calculated results exceeded the set bounds of its corresponding formula.

- - or * on the left side of the column corresponds to F1 (Formula 1)
- - or * in the middle of the column corresponds to F2 (Formula 2)
- - or * on the right side of the column corresponds to F3 (Formula 3)

Table reorganization is suggested when the results of the calculations exceed the bounds set by the formula.

For example, --- indicates that, since the formula results of F1, F2, and F3 are within the set bounds of the formula, no table reorganization is suggested. The notation *-* indicates that the results of F1 and F3 suggest table reorganization, even though F2 is still within its set bounds. The notation *-- indicates that F1 is the only formula exceeding its bounds.

REORG

Each hyphen (-) displayed in this column indicates that the calculated results were within the set bounds of the corresponding formula, and each asterisk (*) indicates that the calculated result exceeded the set bounds of its corresponding formula.

- - or * on the left column corresponds to F4 (Formula 4)
- - or * in the second from left column corresponds to F5 (Formula 5)
- - or * in the middle column corresponds to F6 (Formula 6)
- - or * in the second column from the right corresponds to F7 (Formula 7)
- - or * on the right column corresponds to F8 (Formula 8)

Index reorganization advice is as follows:

* If the results of the calculations for Formula 1,2 and 3 do not exceed the bounds set by the formula and the results of the calculations for Formula 4,5 or 6 do exceed the bounds set, then index reorganization is recommended.

* If only the results of the calculations Formula 7 exceed the bounds set, but the results of Formula 1,2,3,4,5 and 6 are within the set bounds, then cleanup of the indexes using the CLEANUP ONLY option of REORG INDEXES is recommended.

* If the only calculation result to exceed the set bounds is the that of Formula 8, then a cleanup of the pseudo empty pages of the indexes using the CLEANUP ONLY PAGES option of REORG INDEXES is recommended.