Skip site navigation (1) Skip section navigation (2)

Re: Nested transactions and tuple header info

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Manfred Koizar <mkoi-pg(at)aon(dot)at>,David Blasby <dblasby(at)refractions(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Nested transactions and tuple header info
Date: 2004-06-03 21:08:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Alvaro Herrera wrote:
> On Wed, Jun 02, 2004 at 10:57:05AM -0400, Bruce Momjian wrote:
> > Tom Lane wrote:
> >
> > > No, I said own xid --- so the "phantom xid" part is still there.  But
> > > your idea definitely does *not* work unless you use a single CID
> > > sequence for the whole main xact; and I'm still wondering if there's
> > > not a simpler implementation possible given that assumption.
> > 
> > I don't understand why a single counter is needed for phantom xids.  We
> > keep the cmin/cmax on the tuple already, and our own backend can look up
> > the xmin/xmax that goes with the phantom.
> Not sure either way (maybe you are right), but I use the global counter
> anyway because some tests would become a very ugly mess if I didn't.  I
> think the phantom idea is also simpler with the global counter.
> And I see no reason to use local counter.  We certainly are not
> hitting the limit with the global counter, as Tom pointed out recently
> in a thread about the aborted CID bitmaps.

Sure, use the global counter if it helps.  My only point was that I
didn't see how a global counter could reduce the number of times we have
to look up the phantom xid to find the xmin/xmax.

However, if you have a map showing which command counter goes with which
subtransaction, then you _certainly_ could reduce the number of phantom
lookups.  (The command counter cmin/cmax tells you the xmin/xmax).  In
fact, in that case, the phatom xid's are only used on commit so you can
make certain tuples visible/invisible to other transactions.

To find the phantom xid idea, I had to wander around the house for a few
hours thinking of what was in that tuple header and how this could be
accomplished.  I am sorry I led Alvaro initially into thinking he didn't
need to keep the cmin.

  Bruce Momjian                        |
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

pgsql-hackers by date

Next:From: Enrico WeigeltDate: 2004-06-03 21:24:27
Subject: Re: [HACKERS] Not 7.5, but 8.0 ?
Previous:From: Alvaro HerreraDate: 2004-06-03 20:49:03
Subject: Re: Check for prepared statement

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group