diff options
author | Robert Haas <rhaas@postgresql.org> | 2011-04-25 09:52:01 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2011-04-25 09:52:01 -0400 |
commit | 02e6a115cc6149551527a45545fd1ef8d37e6aa0 (patch) | |
tree | 41aa3412dc82b89fa49640aa707affb1d08c30da /src | |
parent | 97e83468513399039878e4a630d577c8b7f5b2db (diff) | |
download | postgresql-02e6a115cc6149551527a45545fd1ef8d37e6aa0.tar.gz postgresql-02e6a115cc6149551527a45545fd1ef8d37e6aa0.zip |
Add fast paths for cases when no serializable transactions are running.
Dan Ports
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/storage/lmgr/predicate.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c index f02d5d5a1e4..48ff9cc151d 100644 --- a/src/backend/storage/lmgr/predicate.c +++ b/src/backend/storage/lmgr/predicate.c @@ -2275,6 +2275,18 @@ PredicateLockTupleRowVersionLink(const Relation relation, TransactionId oldxmin, newxmin; + /* + * Bail out quickly if there are no serializable transactions + * running. + * + * It's safe to do this check without taking any additional + * locks. Even if a serializable transaction starts concurrently, + * we know it can't take any SIREAD locks on the modified tuple + * because the caller is holding the associated buffer page lock. + */ + if (!TransactionIdIsValid(PredXact->SxactGlobalXmin)) + return; + oldblk = ItemPointerGetBlockNumber(&(oldTuple->t_self)); oldoff = ItemPointerGetOffsetNumber(&(oldTuple->t_self)); oldxmin = HeapTupleHeaderGetXmin(oldTuple->t_data); @@ -2633,6 +2645,15 @@ PredicateLockPageSplit(const Relation relation, const BlockNumber oldblkno, PREDICATELOCKTARGETTAG newtargettag; bool success; + /* + * Bail out quickly if there are no serializable transactions + * running. As with PredicateLockTupleRowVersionLink, it's safe to + * check this without taking locks because the caller is holding + * the buffer page lock. + */ + if (!TransactionIdIsValid(PredXact->SxactGlobalXmin)) + return; + if (SkipSplitTracking(relation)) return; |