Skip site navigation (1) Skip section navigation (2)

Another way to reduce pg_subtrans lookup overhead

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Another way to reduce pg_subtrans lookup overhead
Date: 2005-12-01 04:38:48
Message-ID: 6488.1133411928@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
I mentioned yesterday that I'm looking at the problem of excessive
accesses to pg_subtrans when there is an old open transaction:
http://archives.postgresql.org/pgsql-hackers/2005-11/msg01547.php

I thought of a different approach to it, which is to make snapshot
checking take a hint from TransactionIdIsInProgress: use the subxid
caches from the PG_PROC array.  The idea is to have GetSnapshot save
not just the top-level active xids, but also the subxids, plus an
indicator of whether any of the subxids caches are overflowed.
Then, when checking to see if an xid is active according to a snapshot,
we can skip the SubTransGetTopmostTransaction() call if the overflow
flag isn't set --- instead, just look through the subxids for a match.

This approach would reduce the cost of snapshot checking in the "normal"
case where there are no overflowed subxid caches, but it doesn't help at
all if there are; plus it increases the cost of capturing a snapshot.
So I'm not sure how much net win there would be, if any.

Thoughts anyone?

			regards, tom lane

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2005-12-01 05:00:34
Subject: Re: [ADMIN] ERROR: could not read block
Previous:From: Joshua D. DrakeDate: 2005-12-01 04:22:52
Subject: Re: [HACKERS] Upcoming PG re-releases

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group