Re: mvcc & DML on the same row - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: mvcc & DML on the same row
Date
Msg-id 1292508661.1193.3161.camel@ebony
Whole thread Raw
In response to mvcc & DML on the same row  (matteo durighetto <desmodemone@gmail.com>)
Responses Re: mvcc & DML on the same row
List pgsql-hackers
On Wed, 2010-12-15 at 20:50 +0100, matteo durighetto wrote:
> if  we continue the transaction and we do for example another update
> on this row (X) , we again redo the same operation:
> 
>    X0  (deleted "old" row)
>    X1  (row inserted, NOW deleted) => not needed for rollback
>    X2  (insert "new" row  )

This situation has a simple user-space solution: only make one update to
a row, rather than two.

> But why we need all these versions of the same row on table, if for
> rollback we need only the original row X (X0) ?

X1 cannot be removed because X0 points to it, via its t_ctid field.

In order to remove X1 we would need to change X0 to point to X2, which
we don't do because we're not allowed to update in place. Even if we
could, I'm not sure this case is frequent enough to be worth the effort.

-- Simon Riggs           http://www.2ndQuadrant.com/books/PostgreSQL Development, 24x7 Support, Training and Services



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: SQL/MED - file_fdw
Next
From: Nicolas Barbier
Date:
Subject: Re: Extensions, patch v18 (merge against master, bitrot-only-fixes)