Re: Subtransaction commits and Hot Standby

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Subtransaction commits and Hot Standby
Date: 2008-09-16 14:01:24
Message-ID: 48CFBC34.5010802@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Simon Riggs wrote:
> Subtransactions cause a couple of problems for Hot Standby:

Do we need to treat subtransactions any differently from normal
transactions? Just treat all subtransactions as top-level transactions
until commit, and mark them all as committed when you see the commit
record for the top-level transaction.

> 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
> }
>
> All clog updates would be performed page-at-a-time, in ascending xid
> order.
>
> This seems likely to work well since many subtransactions will be on
> same clog page as the top-level xid and the locking will often be more
> efficient than the current case of repeated single lock acquisitions. It
> also means we can skip RecordSubTransactionCommit() entirely,
> significantly reducing clog contention.
>
> Anybody see a problem there?

Hmm, I don't see anything immediately wrong with that.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-09-16 14:02:46 Re: proposal - GROUPING SETS
Previous Message Gregory Stark 2008-09-16 13:52:08 Re: WIP patch: Collation support

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2008-09-16 14:11:49 Re: Subtransaction commits and Hot Standby
Previous Message Simon Riggs 2008-09-16 11:53:43 Subtransaction commits and Hot Standby