Keysorting


Keysort is based on the idea that when we sort a file in memory the only things that we really need to sort are the record keys; therefore, we do not need to read the whole file into memory during the sorting process. Instead, we read the keys from the file into memory, sort them, and then rearrange the records in the file according to the new ordering of the keys.

The following figure shows a conceptual view of KEYNODES array to be used in memory by internal sort routine and record array on secondary store.


The figure below shows a conceptual view of KEYNODES array and file after sorting keys in memory.