Re: Nested Transaction TODO list

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Nested Transaction TODO list
Date: 2004-07-05 06:28:04
Message-ID: 20040705062804.GA10953@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jul 03, 2004 at 11:03:33AM -0400, Tom Lane wrote:

> TransactionIdIsInProgress needs work/review; comments are off for one
> thing, and it seems *way* too inefficient. Note it should be possible to
> skip subtrans search for sufficiently old xacts (hm ... couldn't we skip
> sinval search too...)

I am looking at this now ... the first thing I did was stamp at the
start of the function

if (TransactionIdPrecedes(xid, RecentGlobalXmin))
return false;

So we don't need to check pg_subtrans (nor the PGPROC array) for any
transaction that is too old.

Now, I'm looking at adding the array of cached Xids and I think that
maybe this is not the cure to all the performance problems introduced.
With the cached Xid array we can return quickly for a transaction that
is part of any of the current subtransaction trees, but there's no way
to know about "negative hits"! So any time a Xid that's not part of any
transaction tree is sought, we'd have to revert to pg_subtrans. This
includes an aborted subtransaction of a current transaction tree.

So how about adding two arrays to PGPROC: the cached Xid array (for
subcommitted subxacts) and another which would hold aborted Xids? We
would store Xids of aborted subxacts of the current transaction. (Maybe
we could store Xids of previous transactions of this backend too?)

Instead of the second array, we could have a global TransactionId array
which would hold past transactions and aborted subtransactions for all
backends. At AbortTransaction() and AbortSubTransaction() we would save
the Xid there, using a round-robin scheme.

What do you think?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"No single strategy is always right (Unless the boss says so)"
(Larry Wall)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2004-07-05 07:15:58 Re: Adding VERSION to startup log output
Previous Message Justin Clift 2004-07-05 06:23:22 Re: LinuxTag wrapup