apache > db
Apache DB Project
 
Font size:      

Reclaiming Unused Space

Reclaiming Unused Space

After you determine that a table and its indexes have a significant amount of unused space, use the SYSCS_UTIL.SYSCS_COMPRESS_TABLE procedure to reclaim that space.

Reclaiming space returns it to the operating system. For example, after you have identified that the FlightAvailability table and its related indexes have a significant amount of unused space, you could reclaim that space with the following command:

call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP', 'FLIGHTAVAILABILITY', 0);

By default, the SYSCS_UTIL.SYSCS_COMPRESS_TABLE procedure instructs Derby to compress the table and its related indexes concurrently, which can use a lot of temporary disk space and memory.

The third parameter of the SYSCS_UTIL.SYSCS_COMPRESS_TABLE() procedure determines whether the operation runs in sequential or non-sequential mode. If you specify 0 for the third argument in the procedure, the operation runs in non-sequential mode. To force the operation to run in sequential mode, specify a non-zero smallint argument for the third argument. In sequential mode,Derby compresses the table and indexes sequentially, one at a time. Sequential compression uses less memory and disk space but is slower. The following example shows how to force the operation to run in sequential mode:

call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP', 'FLIGHTAVAILABILITY', 1);

For more information about this command, see the Derby Reference Manual.


Previous Page
Next Page
Table of Contents
Index