Database Reference
In-Depth Information
On-disk Sorts
When a work area is too small to contain all data, the database engine processes the sort in several steps. These steps
are detailed in the following list. The actual number of steps depends, obviously, not only on the amount of data but
also on the size of the work areas.
1.
The data is read from the table and stored in the work area. While storing it, a structure
is built that organizes the data according to the sort criteria. In this example, the data is
sorted according to the id column. This is step 1 in Figure 14-8 .
Figure 14-8. On-disk sort, first sort run
2.
When the work area is full, part of its content is spilled into a temporary segment in the
user's temporary tablespace. This type of data batch is called a sort run . Note that all data
is stored not only in the work area but also in the temporary segment. This is step 2 in
Figure 14-8 .
3.
Since data has been spilled into the temporary segment, some free space is available in
the work area. Therefore, it's possible to continue reading and storing the input data in the
 
Search WWH ::




Custom Search