Tables, directories and locations should be periodically packed to improve performance and reduce storage requirements. The SQL COMPACT command can be used to:
- Free space that was formerly occupied by deleted records.
- Optimize the dictionary files by freeing space that was formerly used for tables that have since been altered or dropped.
- Rebuild indexes:
- When converting from a previous version of the XDB Server.
- After performing many updates or deletions, to optimize space utilization.
- To rebuild corrupt index files.
- Re-order the data in a table according to the order of records in a clustered index.
You can call the SQL COMPACT command from any utility that allows you to issue standard SQL commands (such as the SQLWizard on Windows platform, or Interactive SQL on UNIX). You can also use the SQL COMPACT command in Embedded SQL in COBOL . For more information about this command, see the SQL Reference.
Note:
If you are using XDB Link, you cannot use the COMPACT command against DB2 objects on the mainframe. Instead, log on to the mainframe and use the REORG facility to perform this task.