pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-performance@postgresql.org
Cc: Chris Browne <cbbrowne@acm.org>
Subject: Re: the XID question
Date: Wed, 19 Jan 2011 19:31:51 +0100
Message-ID: <201101191931.52841.andres@anarazel.de> (raw)
In-Reply-To: <878vyg9399.fsf@cbbrowne.afilias-int.info>
References: <ca4f167a-0c04-4c59-9dec-a10d8f43437b@i25g2000prd.googlegroups.com>
	<4D36A35302000025000397CC@gw.wicourts.gov>
	<878vyg9399.fsf@cbbrowne.afilias-int.info>

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



view thread (12+ messages)  latest in thread

Message-ID: <201101191931.52841.andres@anarazel.de>
Permalink:  ../201101191931.52841.andres@anarazel.de/
Also on:    postgresql.org/message-id/201101191931.52841.andres@anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: andres@anarazel.de, cbbrowne@acm.org
  Subject: Re: the XID question
  In-Reply-To: <201101191931.52841.andres@anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox