REORG is about restoring physical organization so Db2 can execute logical access paths efficiently. When table rows drift away from index key order (or become fragmented), IXSCAN and range scans can degrade into random I/O storms.
What “physical drift” looks like
Overflow rows, sparse pages after deletes, pseudo-deleted index entries, low cluster ratio, and a growing gap between expected vs actual I/O.
| Signal | Where you see it | Why it matters |
|---|---|---|
| Overflow rows rising | SYSSTAT.TABLES (overflow) | Extra page reads + CPU to chase relocated rows |
| Cluster ratio low | SYSSTAT.INDEXES (cluster_ratio) | Range scans become random I/O instead of sequential |
| Leaf density poor | Detailed index stats / REORGCHK | More pages to scan → higher I/O |
| Pseudo-deletes accumulate | Index stats / REORGCHK | Wasted index space, deeper trees, longer traversals |
db2 reorgchk current statistics on table <schema>.<tabname>
db2 reorgchk current statistics on table <schema>.<tabname> and indexes all
Operational caution
REORG changes physical layout → can invalidate assumptions for access patterns and may impact concurrency. Prefer online options where feasible and schedule around peak workload.
-- Table indicators
SELECT tabschema, tabname, npages, fpages, overflow
FROM sysstat.tables
WHERE tabschema = '<SCHEMA>' AND tabname = '<TABNAME>';
-- Index clustering indicator
SELECT indschema, indname, cluster_ratio
FROM sysstat.indexes
WHERE tabschema = '<SCHEMA>' AND tabname = '<TABNAME>';
Instructor decision heuristic
If your workload depends on range scans and cluster ratio drops below a practical threshold (often < ~80% in OLTP), REORG becomes a business decision: trade planned maintenance for unplanned performance incidents.
Link it back to the course
Part 4 emphasizes maintenance activities (RUNSTATS/REORG/REORGCHK) as core DBA tuning levers.