Tuples inserted and deleted by the same transaction

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Tuples inserted and deleted by the same transaction
Date: 2022-09-13 08:06:03
Message-ID: f6a491b32cb44bb5daaafec835364f7149348fa1.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Shouldn't such tuples be considered dead right away, even if the inserting
transaction is still active? That would allow cleaning them up even before
the transaction is done.

There is this code in HeapTupleSatisfiesVacuumHorizon:

else if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetRawXmin(tuple)))
{
[...]
/* inserted and then deleted by same xact */
if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetUpdateXid(tuple)))
return HEAPTUPLE_DELETE_IN_PROGRESS;

Why HEAPTUPLE_DELETE_IN_PROGRESS and not HEAPTUPLE_DEAD?

Yours,
Laurenz Albe

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message bt22kawamotok 2022-09-13 08:25:26 Re: is_superuser is not documented
Previous Message Kyotaro Horiguchi 2022-09-13 07:31:22 Re: Error "initial slot snapshot too large" in create replication slot