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

From Heikki Linnakangas
Subject Re: Subtransaction commits and Hot Standby
Date
Msg-id 48CFBC34.5010802@enterprisedb.com
Whole thread Raw
In response to Subtransaction commits and Hot Standby  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: Subtransaction commits and Hot Standby  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: Subtransaction commits and Hot Standby  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: WIP patch: Collation support
Next
From: Tom Lane
Date:
Subject: Re: proposal - GROUPING SETS