pg.ddx.io  pgsql-patches@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Simon Riggs <simon@2ndQuadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Subtransaction commits and Hot Standby
Date: Tue, 16 Sep 2008 17:01:24 +0300
Message-ID: <48CFBC34.5010802@enterprisedb.com> (raw)
In-Reply-To: <1221566023.3913.1823.camel@ebony.2ndQuadrant>
References: <1221566023.3913.1823.camel@ebony.2ndQuadrant>

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



view thread (18+ messages)  latest in thread

Message-ID: <48CFBC34.5010802@enterprisedb.com>
Permalink:  ../48CFBC34.5010802@enterprisedb.com/
Also on:    postgresql.org/message-id/48CFBC34.5010802@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-patches@postgresql.org
  Cc: heikki.linnakangas@enterprisedb.com, simon@2ndQuadrant.com, pgsql-hackers@postgresql.org
  Subject: Re: Subtransaction commits and Hot Standby
  In-Reply-To: <48CFBC34.5010802@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox