Re: Subtransaction commits and Hot Standby - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Subtransaction commits and Hot Standby
Date
Msg-id 1221585494.3913.1919.camel@ebony.2ndQuadrant
Whole thread Raw
In response to Re: Subtransaction commits and Hot Standby  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
On Tue, 2008-09-16 at 10:11 -0400, Alvaro Herrera wrote:

> >> Right now we lock and unlock the clog for each committed subtransaction
> >> at commit time, which is wasteful. A better scheme:
> >>   pre-scan the list of xids to derive list of pages
> >>   if we have just a single page to update
> >>   {
> >>         update all entries on page in one action
> >>   }
> >>   else
> >>   {
> >>         loop thru xids marking them all as subcommitted
> >>     mark top level transaction committed
> >>         loop thus xids again marking them all as committed
> >>   }
>
> > Hmm, I don't see anything immediately wrong with that.
>
> Neither do I.
>
> I wonder if the improved clog API required to mark multiple transactions
> as committed at once would be also useful to TransactionIdCommitTree
> which is used in regular transaction commit.

I enclose a patch to transform what we have now into what I think is
possible. If we agree this is possible, then I will do further work to
optimise transam.c (using clog.c changes also). So this is an
"intermediate" or precursor patch for discussion only.

 backend/access/transam/transam.c  |   78 ++++++++++++-----------------!
 backend/access/transam/twophase.c |    4 !
 backend/access/transam/xact.c     |   50 -----------------!!!!!!!
 include/access/transam.h          |    7 !!!
 4 files changed, 32 insertions(+), 78 deletions(-), 29 modifications(!)

--
 Simon Riggs           www.2ndQuadrant.com
 PostgreSQL Training, Services and Support

Attachment

pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Common Table Expressions (WITH RECURSIVE) patch
Next
From: Simon Riggs
Date:
Subject: Re: Subtransaction commits and Hot Standby