16. Calculating Disk Space : Space Requirements for Sorts
 
Share this page                  
Space Requirements for Sorts
Sorting occurs commonly during many index, copy, and modify operations. (Sorting also occurs in the processing of the equivalent SQL statements.)
When the size of the sort requires disk space, temporary work locations are used.
A default work location area is defined during installation.
The disk space required for sorting depends on how much sorting needs to be done. If the table to be sorted is badly out of sorted order, more space can be used than if it is in nearly sorted order.
For a nearly sorted table, the amount of work location space is equal to the uncompressed size of the table.
For a table that is badly out of order, the maximum work location space is two times the uncompressed size of the table, and the space required per location can be estimated by the formula:
(2 * uncompressed_table_size) / number_of_work_locations