Re: Subtransaction commits and Hot Standby

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Subtransaction commits and Hot Standby
Date: 2008-09-16 17:18:14
Message-ID: 1221585494.3913.1919.camel@ebony.2ndQuadrant
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


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 Content-Type Size
atomic_subxids.v1.patch text/x-patch 11.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2008-09-16 17:28:41 Re: Subtransaction commits and Hot Standby
Previous Message Jeff Davis 2008-09-16 16:41:19 Re: Common Table Expressions (WITH RECURSIVE) patch

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2008-09-16 17:28:41 Re: Subtransaction commits and Hot Standby
Previous Message Alvaro Herrera 2008-09-16 15:08:51 Re: Subtransaction commits and Hot Standby