[prev] 50 [next]

Deletion in Heaps (cont)

PostgreSQL tuple deletion:

heap_delete(Relation relation,    // relation desc
            ItemPointer tid, ..., // tupleID
            CommandId cid, ...)   // SQL statement

  • gets page containing tuple into buffer pool and locks it
  • sets flags, commandID and xmax in tuple; dirties buffer
  • writes indication of deletion to transaction log (at commit time)
Vacuuming eventually compacts space in each page.