Re: Tuples inserted and deleted by the same transaction

2022-09-13 Thread Laurenz Albe
On Tue, 2022-09-13 at 16:13 +0200, Matthias van de Meent wrote: > On Tue, 13 Sept 2022 at 15:45, Tom Lane wrote: > > Laurenz Albe writes: > > > But once they are deleted or updated, even the transaction that created > > > them cannot > > > see them any more, right? > > > > I would not trust tha

Re: Tuples inserted and deleted by the same transaction

2022-09-13 Thread Matthias van de Meent
On Tue, 13 Sept 2022 at 15:45, Tom Lane wrote: > > Laurenz Albe writes: > > But once they are deleted or updated, even the transaction that created > > them cannot > > see them any more, right? > > I would not trust that claim very far. The transaction might have active > snapshots with a comma

Re: Tuples inserted and deleted by the same transaction

2022-09-13 Thread Tom Lane
Laurenz Albe writes: > But once they are deleted or updated, even the transaction that created them > cannot > see them any more, right? I would not trust that claim very far. The transaction might have active snapshots with a command ID between the times of insertion and deletion. (Consider a

Re: Tuples inserted and deleted by the same transaction

2022-09-13 Thread Matthias van de Meent
On Tue, 13 Sept 2022 at 12:40, Pantelis Theodosiou wrote: > > Forgive me if this is not related but if there is a savepoint between > the insertion and deletion, wouldn't it be possible for the > transaction to recover the deleted tuples? Savepoints result in changed TransactionIds (well, subtran

Re: Tuples inserted and deleted by the same transaction

2022-09-13 Thread Matthias van de Meent
On Tue, 13 Sep 2022, 12:04 Laurenz Albe, wrote: > > On Tue, 2022-09-13 at 11:47 +0300, Nikita Malakhov wrote: >> 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 t

Re: Tuples inserted and deleted by the same transaction

2022-09-13 Thread Pantelis Theodosiou
On Tue, Sep 13, 2022 at 11:04 AM Laurenz Albe wrote: > > On Tue, 2022-09-13 at 11:47 +0300, Nikita Malakhov wrote: > > On Tue, Sep 13, 2022 at 11:06 AM Laurenz Albe > > wrote: > > > Shouldn't such tuples be considered dead right away, even if the inserting > > > transaction is still active? Tha

Re: Tuples inserted and deleted by the same transaction

2022-09-13 Thread Laurenz Albe
On Tue, 2022-09-13 at 11:47 +0300, Nikita Malakhov wrote: > On Tue, Sep 13, 2022 at 11:06 AM Laurenz Albe > 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

Re: Tuples inserted and deleted by the same transaction

2022-09-13 Thread Nikita Malakhov
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 A