How a sort-merge is performed

For a sort-merge join, there are three steps, since the inputs to the sort-merge joins are both sorted worktables:

  1. A table or set of tables is scanned and the results are inserted into one worktable. This will be the outer table in the merge.

  2. Another table is scanned and the results are inserted into another worktable. This will be the inner table in the merge.

  3. Each of the worktables is sorted, then the two sorted result sets are merged.