12. Using the Query Optimizer : Types of Nodes in a QEP : Sort Nodes in a QEP
 
Share this page                  
Sort Nodes in a QEP
Many types of nodes can also be shown as sort nodes. A sorting node causes the data to be sorted as it is returned. Any node other than an orig node can appear with a sort indication. A query with a SORT clause has a sort node as the topmost node in the QEP. This type of node displays:
Total number of pages and tuples
Query cost information
For a description of each of these parts of the display, see Information on a QEP (see page Information on a QEP).
Sort nodes make use of a sort buffer and so consume primarily CPU resources, requiring disk I/O only when the volume of data to be sorted cannot be accommodated in the sort buffer. The heapsort algorithm is used; it is very fast on both unordered data and data which is nearly sorted.