"Pavan Deolasee" <pavan.deolasee@gmail.com> writes:
> On 9/21/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Shouldn't we be able to prune rows that have been inserted and deleted
>> by the same transaction? I'd have hoped to see this example use only
>> one heap page ...
>>
> Not before the transaction commits ? In the test, we update a single tuple
> 10000 times in the same transaction. So there is no opportunity to prune.
[ looks a bit more ... ] Hm, the test I was thinking of was this one
at the end of HeapTupleSatisfiesVacuum:
if (TransactionIdEquals(HeapTupleHeaderGetXmin(tuple), HeapTupleHeaderGetXmax(tuple))) {
/* * Inserter also deleted it, so it was never visible to anyone else. * However, we can only remove
itearly if it's not an updated tuple; * else its parent tuple is linking to it via t_ctid, and this tuple
*mustn't go away before the parent does. */ if (!(tuple->t_infomask & HEAP_UPDATED)) return
HEAPTUPLE_DEAD; }
but control never gets that far because neither xmin nor xmax is
committed yet. We could fix that, probably, by considering the
xmin=xmax case in the xmin-in-progress case further up; but the
HEAP_UPDATED exclusion is still a problem. Still, it seems like this
is leaving some money on the table when you think about pruning a HOT
chain. Can we improve on it easily?
regards, tom lane