Skip to content

Sorting

  • sorting can be done logically through an index, as opposed to physical. This may lead to a lot of disk block accesses though. So, it's desirable to sort the records physically.
  • for relations that fit in memory, quicksort is good.
  • for relations that don't fit in memory, external sort-merge works better because it's in-place.

Differences from Mergesort

  • processing is done block-by-block
  • the merging is an \(N\)-way merge between \(M\) blocks.