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