Storage, Execution & Recovery Internals

Space Reclamation and Maintenance

Deletes and updates usually make bytes logically obsolete before they become physically reusable. Reclamation must prove that no active snapshot or recovery/replication consumer needs an old version, then prune, compact, vacuum, merge, or rewrite while controlling bloat and foreground interference.
  • Logical death precedes physical reuse.
  • Page pruning and file shrinking are different.
  • Long snapshots pin history.
  • Bloat amplifies unrelated work.
  • Compaction moves bytes and consumes resources.
  • Maintenance must outrun garbage creation.
Version-to-reusable-space lifecycle
Maintenance levels
ActionReclaimsUsually does not guaranteeRisk
Prune/garbage collectDead record/version referencesSmaller fileCPU/latch contention
Vacuum/mergeReusable pages/segments and metadataOS space returnI/O/WAL backlog
Truncate tailEmpty trailing blocksInternal-hole removalLock/horizon constraints
Rewrite/repackDense new physical copyCheap online operationSpace, WAL, lock and replica load