Sorting in PostgreSQL (cont)
Disk-based sort has phases:
- divide input into sorted runs using HeapSort
- merge using N buffers, one output buffer
- N = as many buffers as
workMem allows
Described in terms of "tapes" ("tape" ≅ sorted run)
Implementation of "tapes": backend/utils/sort/logtape.c
|