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
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers