Insertion in Heaps (cont)
PostgreSQL's tuple insertion:
heap_insert(Relation relation,
HeapTuple newtup,
CommandId cid, ...)
|
- finds page which has enough free space for
newtup
- ensures page loaded into buffer pool and locked
- copies tuple data into page buffer, sets
xmin , etc.
- marks buffer as dirty
- writes details of insertion into transaction log
- returns OID of new tuple if relation has OIDs
|