Conceptual
Login

External Merge Sort

When data exceeds memory, the engine sorts memory-sized chunks into sorted runs on disk, then merges the runs in one or more passes. This is how databases implement large ORDER BY and sort-based joins, and why a sort that fits in memory is dramatically faster than one that spills.

Questions this Concept answers

  • Why is a sort that spills so much slower than one that fits in memory?