Re: Tuples inserted and deleted by the same transaction

Поиск
Список
Период
Сортировка
От Nikita Malakhov
Тема Re: Tuples inserted and deleted by the same transaction
Дата
Msg-id CAN-LCVPzTbeKx6U8vyb0TGbw_Zff+jv=RArZy7Oh7CO6g7_V+A@mail.gmail.com
обсуждение исходный текст
Ответ на Tuples inserted and deleted by the same transaction  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: Tuples inserted and deleted by the same transaction  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-hackers
Hi!

Please correct me if I'm wrong, despite tuples being inserted and deleted by the same 
transaction - they are visible inside the transaction and usable by it, so considering them
dead and cleaning up during execution is a bad idea until the transaction is ended.

On Tue, Sep 13, 2022 at 11:06 AM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
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


--
Regards,
Nikita Malakhov
Postgres Professional 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: John Naylor
Дата:
Сообщение: Re: proposal: possibility to read dumped table's name from file
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Splitting up guc.c