Re: the XID question - Mailing list pgsql-performance

From Andres Freund
Subject Re: the XID question
Date
Msg-id 201101191931.52841.andres@anarazel.de
Whole thread Raw
In response to Re: the XID question  (Chris Browne <cbbrowne@acm.org>)
Responses Re: the XID question  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-performance
On Wednesday, January 19, 2011 07:06:58 PM Chris Browne wrote:
> Kevin.Grittner@wicourts.gov ("Kevin Grittner") writes:
> > Filip Rembia*kowski<plk.zuber@gmail.com> wrote:
> >> 2011/1/19 Charles.Hou <givemeegn@gmail.com>:
> >>> " select * from mybook" SQL command also increase the XID ?
> >>
> >> Yes. Single SELECT is a transaction. Hence, it needs a transaction
> >> ID.
> >
> > No, not in recent versions of PostgreSQL.  There's virtual
> > transaction ID, too; which is all that's needed unless the
> > transaction writes something.
> >
> > Also, as a fine point, if you use explicit database transactions
> > (with BEGIN or START TRANSACTION) then you normally get one XID for
> > the entire transaction, unless you use SAVEPOINTs.
>
> Erm, "not *necessarily* in recent versions of PostgreSQL."
>
> A read-only transaction won't consume XIDs, but if you don't expressly
> declare it read-only, they're still liable to get eaten...
No. The Xid is generally only allocated at the first place a real xid is
needed. See GetCurrentTransactionId, AssignTransactionId in xact.c and the
caller of the former.

Andres

pgsql-performance by date:

Previous
From: Chris Browne
Date:
Subject: Re: the XID question
Next
From: "Kevin Grittner"
Date:
Subject: Re: the XID question