Re: a few questions (and doubts) about xid - Mailing list pgsql-general

From Tom Lane
Subject Re: a few questions (and doubts) about xid
Date
Msg-id 26404.1185458659@sss.pgh.pa.us
Whole thread Raw
In response to Re: a few questions (and doubts) about xid  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: a few questions (and doubts) about xid
List pgsql-general
Alvaro Herrera <alvherre@commandprompt.com> writes:
> What's going on here is that we use Xmax not only for storing "this
> transaction deleted the row" but also for storing "this transaction
> locked the row".  So the row is not really deleted at all.  The
> IS_LOCKED bit tells you whether the row is locked or deleted when the
> Xmax is set.

> Of course, a locked row cannot be deleted.  When you want to delete a
> row that you have previously locked, you reset the IS_LOCKED bit.

Perhaps more accurately, a row that has been outdated (either replaced
by an updated version, or deleted) is also considered locked by the
Xmax transaction, until such time as that transaction commits or rolls
back.  Other xacts that might want to modify the row have to wait for
the Xmax xact before they can know whether it's OK to modify or not.

The IS_LOCKED bit serves as a means of locking the row without actually
modifying it (yet).  The locking semantics aren't really any different.

            regards, tom lane

pgsql-general by date:

Previous
From: "James B. Byrne"
Date:
Subject: Re: ssl connections to postgresql
Next
From: Richard Huxton
Date:
Subject: Re: ssl connections to postgresql